def save_db(name, data, module): """ Save request results to database :param str name: table name :param list data: data to be saved :param str module: module name """ db = Database() db.drop_table(name) db.create_table(name) db.save_db(name, data, module) db.close()
def export(self, table): """ Export data from the database and do some follow-up processing :param table: table name :return: export data :rtype: list """ db = Database() data = dbexport.export(table, type='table', alive=self.alive, format=self.format) db.drop_table(self.new_table) db.rename_table(self.domain, self.new_table) db.close() return data
def mark(self): """ Mark the new discovered subdomain :return: marked data :rtype: list """ db = Database() old_data = list() now_data = db.get_data(self.domain).as_dict() # Database pre-processing when it is not the first time to collect this subdomain if db.exist_table(self.new_table): # If there is the last collection result table, delete it first db.drop_table(self.old_table) # Rename the new table to the old table db.rename_table(self.new_table, self.old_table) old_data = db.get_data(self.old_table).as_dict() db.close() marked_data = utils.mark_subdomain(old_data, now_data) return marked_data