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() }
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, }
class SourceCode(db.Model): __tablename__ = 'source_code' id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(255)) author = db.Column(db.String(255)) introduction = db.Column(db.String(255)) code_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(SourceCode, self).__init__(**kwargs) __mapper_args__ = { "order_by": id.desc() } def to_json(self): return { "id": self.id, "name": self.name, "author": self.author, "introduction": self.introduction, "code_update_time": int(time.mktime(self.code_update_time.timetuple())), "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 }
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()), }
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
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 }
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 }
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 }