Esempio n. 1
0
class Keyword(db.Model):
    __tablename__ = 'keyword'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    keyword = db.Column(db.String(255))
    group = db.Column(db.String(255))
    judge = db.Column(db.Integer)

    def to_json(self):
        return {
            'id': self.id,
            'keyword': self.keyword,
            'group': self.group,
            'judge': self.judge,
        }

    __mapper_args__ = {
        "order_by": id.desc()
    }
Esempio n. 2
0
class Account(db.Model):
    __tablename__ = 'account'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    website = db.Column(db.String(255))
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))
    email = db.Column(db.String(255))
    key = db.Column(db.String(255))

    def to_json(self):
        return {
            'id': self.id,
            'website': self.website,
            'username': self.username,
            'password': self.password,
            'email': self.email,
            'key': self.key,
        }
Esempio n. 3
0
class NetworkDisk(db.Model):
    __tablename__ = 'network_disk'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255))
    share_people = db.Column(db.String(255))
    share_time = db.Column(db.DateTime)
    file_list = db.Column(db.String(255))
    file_size = db.Column(db.String(255))
    source = db.Column(db.String(255))
    url = db.Column(db.String(255))
    url_md5 = db.Column(db.String(255))
    screenshot = db.Column(db.String(255))
    suspect_level = db.Column(db.Integer())
    scan_time = db.Column(db.DateTime)
    is_read = db.Column(db.Integer())
    location = db.Column(db.String(255))
    company = db.Column(db.String(255))
    remark = db.Column(db.String(255))

    def __init__(self, **kwargs):
        super(NetworkDisk, self).__init__(**kwargs)

    __mapper_args__ = {
        "order_by": id.desc()
    }

    def to_json(self):
        return {
            "id": self.id,
            "name": self.name,
            "share_people": self.share_people,
            "share_time": int(time.mktime(self.share_time.timetuple())) if self.share_time else 0,
            "file_list": self.file_list,
            "file_size": self.file_size,
            "url": self.url,
            "url_md5": self.url_md5,
            "source": self.source,
            "screenshot": self.screenshot,
            "suspect_level": self.suspect_level,
            "scan_time": int(time.mktime(self.scan_time.timetuple())),
            "is_read": self.is_read,
            'location': self.location,
            'company': self.company,
            'remark': self.remark
        }
Esempio n. 4
0
class Website(db.Model):
    __tablename__ = 'website'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    title = db.Column(db.String(255))
    url = db.Column(db.String(255))
    url_md5 = db.Column(db.String(255))
    screenshot = db.Column(db.String(255))
    source = db.Column(db.String(255))
    suspect_level = db.Column(db.String(255))
    keyword = db.Column(db.String(255))
    scan_time = db.Column(db.DateTime)
    location = db.Column(db.String(255))
    company = db.Column(db.String(255))
    remark = db.Column(db.String(255))
    is_read = db.Column(db.Integer())

    def __init__(self, **kwargs):
        super(Website, self).__init__(**kwargs)

    __mapper_args__ = {
        "order_by": id.desc()
    }

    def to_json(self):
        return {
            'id': self.id,
            'title': self.title,
            'url': self.url,
            'url_md5': self.url_md5,
            'location': self.location,
            'company': self.company,
            "is_read": self.is_read,
            'remark': self.remark,
            'source': self.source,
            'screenshot': self.screenshot,
            'suspect_level': self.suspect_level,
            "scan_time": int(time.mktime(self.scan_time.timetuple()) if self.scan_time else time.time()),
        }
Esempio n. 5
0
class Document(db.Model):
    __tablename__ = 'document'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255))
    introduction = db.Column(db.String(255))
    upload_people = db.Column(db.String(255))
    upload_time = db.Column(db.DateTime)  # int(time.mktime(self.update_time.timetuple()))
    doc_remark = db.Column(db.String(255))
    source = db.Column(db.String(255))
    url = db.Column(db.String(255))
    url_md5 = db.Column(db.String(255))
    screenshot = db.Column(db.String(255))
    suspect_level = db.Column(db.Integer())
    scan_time = db.Column(db.DateTime)
    is_read = db.Column(db.Integer())
    location = db.Column(db.String(255))
    company = db.Column(db.String(255))
    remark = db.Column(db.String(255))
    keyword = db.Column(db.String(255))

    def __init__(self, **kwargs):
        super(Document, self).__init__(**kwargs)

    __mapper_args__ = {
        "order_by": id.desc()
    }

    def to_json(self):
        return {
            "id": self.id,
            "name": self.name,
            "introduction": self.introduction,
            "upload_people": self.upload_people,
            "upload_time": self.upload_time,
            "doc_remark": self.doc_remark,
            "source": self.source,
            "url": self.url,
            "url_md5": self.url_md5,
            "screenshot": self.screenshot,
            "suspect_level": self.suspect_level,
            "is_read": self.is_read,
            "scan_time": int(time.mktime(self.scan_time.timetuple()) if self.scan_time else time.time()),
            'location': self.location,
            'company': self.company,
            'remark': self.remark,
            'keyword': self.keyword
        }
Esempio n. 6
0
class User(UserMixin, db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))
    role = db.Column(db.String(255))
    status = db.Column(db.Boolean())
    telephone = db.Column(db.String(255))
    email = db.Column(db.String(255))
    token = db.Column(db.String(255))
    login_time = db.Column(db.DateTime)
    error_times = db.Column(db.SmallInteger())
    create_time = db.Column(db.DateTime)

    def __init__(self, **kwargs):
        super(User, self).__init__(**kwargs)

    def to_json(self):
        return {
            'id': self.id,
            'username': self.username,
            'password': self.password,
            'role': self.role,
            'status': self.status,
            'telephone': self.telephone,
            'email': self.email,
            'create_time': int(time.mktime(self.create_time.timetuple()) if self.create_time else time.time())
        }

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return str(self.id)

    # @property
    # def password(self):
    #     raise AttributeError('password is not a readable attribute')
    #
    # def set_password(self, password):  # 用来设置密码的方法,接受密码作为参数
    #     self.password_hash = generate_password_hash(password)  # 将生成的密码保持到对应字段

    def validate_password(self, password):  # 用于验证密码的方法,接受密码作为参数
        return password == self.password
Esempio n. 7
0
class Wechat(db.Model):
    __tablename__ = 'wechat'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255))
    account = db.Column(db.String(255))
    introduction = db.Column(db.String(255))
    authentication = db.Column(db.DateTime)  # int(time.mktime(self.update_time.timetuple()))
    recent_article = db.Column(db.String(255))
    recent_article_update_time = db.Column(db.String(255))
    url = db.Column(db.String(255))
    url_md5 = db.Column(db.String(255))
    screenshot = db.Column(db.String(255))
    suspect_level = db.Column(db.Integer())
    scan_time = db.Column(db.DateTime)
    is_read = db.Column(db.Integer())
    location = db.Column(db.String(255))
    company = db.Column(db.String(255))
    remark = db.Column(db.String(255))

    def __init__(self, **kwargs):
        super(Wechat, self).__init__(**kwargs)

    __mapper_args__ = {
        "order_by": id.desc()
    }

    def to_json(self):
        return {
            "id": self.id,
            "name": self.name,
            "account": self.account,
            "introduction": self.introduction,
            "authentication": self.authentication,
            "recent_article": self.recent_article,
            "recent_article_update_time": int(
                time.mktime(self.recent_article_update_time.timetuple())) if self.recent_article_update_time else 0,
            "url": self.url,
            "url_md5": self.url_md5,
            "screenshot": self.screenshot,
            "suspect_level": self.suspect_level,
            "scan_time": int(time.mktime(self.scan_time.timetuple()) if self.scan_time else time.time()),
            "is_read": self.is_read,
            'location': self.location,
            'company': self.company,
            'remark': self.remark
        }
Esempio n. 8
0
class MobileApp(db.Model):
    __tablename__ = 'app'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255))
    developer = db.Column(db.String(255))
    version = db.Column(db.String(255))
    download_count = db.Column(db.String(255))
    app_size = db.Column(db.String(255))
    introduction = db.Column(db.String(255))
    app_update_time = db.Column(db.DateTime)  # int(time.mktime(self.update_time.timetuple()))
    source = db.Column(db.String(255))
    url = db.Column(db.String(255))
    url_md5 = db.Column(db.String(255))
    screenshot = db.Column(db.String(255))
    suspect_level = db.Column(db.Integer())
    scan_time = db.Column(db.DateTime)
    is_read = db.Column(db.Integer())
    location = db.Column(db.String(255))
    company = db.Column(db.String(255))
    remark = db.Column(db.String(255))

    def __init__(self, **kwargs):
        super(MobileApp, self).__init__(**kwargs)

    __mapper_args__ = {
        "order_by": id.desc()
    }

    def to_json(self):
        return {
            "id": self.id,
            "name": self.name,
            "introduction": self.introduction,
            "developer": self.developer,
            "app_update_time": int(time.mktime(self.app_update_time.timetuple())),
            "app_info": f"{self.download_count}; app大小: {self.app_size}; 版本:{self.version}",
            "source": self.source,
            "url": self.url,
            "url_md5": self.url_md5,
            "screenshot": self.screenshot,
            "suspect_level": self.suspect_level,
            "scan_time": int(time.mktime(self.scan_time.timetuple())),
            "is_read": self.is_read,
            'location': self.location,
            'company': self.company,
            'remark': self.remark
        }