def parse_DownloadFile(self, db_path, table_name): """ databases/flyflowdownload.db - bddownloadtable 下载目录: /storage/emulated/0/baidu/flyflow/downloads/ RecNo FieldName SQLType 1 manual INTEGER 2 quiet INTEGER 3 attribute TEXT 4 completetime LONG 5 createdtime LONG 6 style TEXT 7 filename TEXT 8 key TEXT 9 priority INTEGER 10 progressmap TEXT 11 referer TEXT 12 savepath TEXT 13 status INTEGER 14 total LONG 15 current LONG 16 type TEXT 17 url TEXT """ # tp 'table_name:', self.root.AbsolutePath if not self._read_db(db_path): return for rec in self._read_table(table_name): if self._is_empty(rec, 'filename', 'url') or not self._is_url(rec, 'url'): continue if self._is_duplicate(rec, 'createdtime'): continue # tp('filename', rec['filename'].Value) downloads = model_browser.DownloadFile() downloads.url = rec['url'].Value downloads.filename = rec['filename'].Value downloads.filefolderpath = self._convert_2_nodepath( rec['savepath'].Value, downloads.filename) downloads.totalsize = rec['total'].Value downloads.createdate = rec['createdtime'].Value downloads.donedate = rec['completetime'].Value costtime = downloads.donedate - downloads.createdate downloads.costtime = costtime if costtime > 0 else None # 毫秒 # downloads.owneruser = rec['name'].Value downloads.source = self.cur_db_source downloads.deleted = 1 if rec.IsDeleted else 0 try: self.csm.db_insert_table_downloadfiles(downloads) except: exc() try: self.csm.db_commit() except: exc()
def parse_DownloadFile(self, URLS, table_name): ''' Default/History - downloads FieldName SQLType id INTEGER guid VARCHAR current_path LONGVARCHAR target_path LONGVARCHAR start_time INTEGER received_bytes INTEGER total_bytes INTEGER state INTEGER danger_type INTEGER interrupt_reason INTEGER hash BLOB end_time INTEGER opened INTEGER last_access_time INTEGER transient INTEGER referrer VARCHAR site_url VARCHAR tab_url VARCHAR tab_referrer_url VARCHAR http_method VARCHAR by_ext_id VARCHAR by_ext_name VARCHAR etag VARCHAR last_modified VARCHAR mime_type VARCHAR 255 original_mime_type VARCHAR 255 ''' for rec in self._read_table(table_name): try: if (self._is_empty(rec, 'target_path') or self._is_duplicate(rec, 'id')): continue downloads = model_browser.DownloadFile() downloads.id = rec['id'].Value downloads.url = URLS.get(downloads.id, None) downloads.filefolderpath = self._convert_nodepath(rec['target_path'].Value) downloads.filename = rec['target_path'].Value.split('/')[-1] downloads.totalsize = rec['total_bytes'].Value downloads.createdate = self._convert_webkit_ts(rec['start_time'].Value) downloads.donedate = self._convert_webkit_ts(rec['end_time'].Value) # costtime = downloads.donedate - downloads.createdate # downloads.costtime = costtime if costtime > 0 else None downloads.owneruser = self.cur_account_name downloads.source = self.cur_db_source downloads.deleted = 1 if rec.IsDeleted else 0 self.csm.db_insert_table_downloadfiles(downloads) except: exc() self.csm.db_commit()
def parse_DownloadFile(self, db_path, table_name): ''' 'databases/RecentFile.db' - recent_file FieldName SQLType id integer full_path text display_name text bucket_name text modify_time integer data_type text data_source text duration integer thumbnail text install_state integer size integer origin_id integer extra_param text ''' if not self._read_db(db_path): return for rec in self._read_table(table_name): try: if self._is_empty(rec, 'display_name') or self._is_duplicate(rec, 'id'): continue downloads = model_browser.DownloadFile() downloads.id = rec['id'].Value # downloads.url = rec['url'].Value downloads.filename = rec['display_name'].Value downloads.filefolderpath = self._convert_nodepath(rec['full_path'].Value) downloads.totalsize = rec['size'].Value # downloads.createdate = rec['modify_time'].Value downloads.donedate = rec['modify_time'].Value # costtime = downloads.donedate - downloads.createdate # downloads.costtime = costtime if costtime > 0 else None downloads.owneruser = self.cur_account_name downloads.source = self.cur_db_source downloads.deleted = 1 if rec.IsDeleted else 0 self.csm.db_insert_table_downloadfiles(downloads) except: exc() self.csm.db_commit()
def analyze_downloadfiles(self): downloadfile = model_browser.DownloadFile() pattern = re.compile('[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]') try: node = self.node.Parent.GetByPath('/download_database') self.db = SQLiteParser.Database.FromNode(node, canceller) if self.db is None: return ts = SQLiteParser.TableSignature('download') for rec in self.db.ReadTableRecords(ts, self.extractDeleted, True): canceller.ThrowIfCancellationRequested() downloadfile.id = rec['id'].Value if 'id' in rec else None downloadfile.url = rec['url'].Value if 'url' in rec and rec[ 'url'].Value is not '' else None downloadfile.filename = rec[ 'filename'].Value if 'filename' in rec and rec[ 'filename'].Value is not '' else None if not IsDBNull(rec['filename'].Value): downloadfile.filefolderpath = self._transToAbsolutePath( rec['filename'].Value) if 'filename' in rec and rec[ 'filename'].Value is not '' else None downloadfile.totalsize = rec[ 'totalsize'].Value if 'totalsize' in rec else None if not IsDBNull(rec['createdate'].Value): downloadfile.createdate = self._timeHandler( rec['createdate'].Value ) if 'createdate' in rec else None if not IsDBNull(rec['donedate'].Value): downloadfile.donedate = self._timeHandler( rec['donedate'].Value) if 'donedate' in rec else None downloadfile.costtime = rec[ 'costtime'].Value if 'costtime' in rec else None downloadfile.deleted = rec.IsDeleted downloadfile.source = node.AbsolutePath self.mb.db_insert_table_downloadfiles(downloadfile) self.mb.db_commit() except Exception as e: traceback.print_exc() print(e)
def parse_DownloadFile(self, db_path, table_name): """ downloads.db - downloads RecNo FieldName SQLType Size 1 _id INTEGER 2 uri TEXT 3 method INTEGER 4 entity TEXT 5 no_integrity BOOLEAN 6 hint TEXT 7 otaupdate BOOLEAN 8 _data TEXT 9 mimetype TEXT 10 destination INTEGER 11 no_system BOOLEAN 12 visibility INTEGER 13 control INTEGER 14 status INTEGER 15 numfailed INTEGER 16 lastmod BIGINT 17 notificationpackage TEXT 18 notificationclass TEXT 19 notificationextras TEXT 20 cookiedata TEXT 21 useragent TEXT 22 referer TEXT 23 total_bytes INTEGER 24 current_bytes INTEGER 25 etag TEXT 26 uid INTEGER 27 otheruid INTEGER 28 title TEXT 29 description TEXT 30 scanned BOOLEAN 31 is_public_api INTEGER 32 allow_roaming INTEGER 33 allowed_network_types INTEGER 34 is_visible_in_downloads_ui INTEGER 35 bypass_recommended_size_limit INTEGER 36 mediaprovider_uri TEXT 37 deleted BOOLEAN 38 range_start_byte INTEGER 39 range_end_byte INTEGER 40 range_byte TEXT 41 boundary TEXT 42 downloadMod INTEGER """ if not self._read_db(db_path): return for rec in self._read_table(table_name): if canceller.IsCancellationRequested: return if self._is_empty(rec, 'uri', 'title') or not self._is_url(rec, 'uri'): continue if self._is_duplicate(rec, '_id'): continue downloads = model_browser.DownloadFile() downloads.id = rec['_id'].Value downloads.url = rec['uri'].Value downloads.filename = rec['title'].Value downloads.filefolderpath = self._convert_2_nodepath( rec['_data'].Value, downloads.filename) downloads.totalsize = rec['total_bytes'].Value # downloads.createdate = rec['createdtime'].Value downloads.donedate = rec['lastmod'].Value # downloads.costtime = downloads.donedate - downloads.createdate # 毫秒 # downloads.owneruser = rec['name'].Value downloads.deleted = 1 if rec.IsDeleted else rec['deleted'].Value downloads.source = self.cur_db_source try: self.csm.db_insert_table_downloadfiles(downloads) except: exc() try: self.csm.db_commit() except: exc()
def _parse_DownloadFile(self, table_name): ''' com.android.providers.downloads/databases/downloads.db - downloadmanagement VIVO: no notificationpackage, deleted FieldName SQLType _id INTEGER uri TEXT method INTEGER entity TEXT no_integrity BOOLEAN hint TEXT otaupdate BOOLEAN _data TEXT mimetype TEXT destination INTEGER no_system BOOLEAN visibility INTEGER control INTEGER status INTEGER numfailed INTEGER lastmod BIGINT notificationpackage TEXT notificationclass TEXT notificationextras TEXT cookiedata TEXT useragent TEXT referer TEXT total_bytes INTEGER current_bytes INTEGER etag TEXT uid INTEGER otheruid INTEGER title TEXT description TEXT scanned BOOLEAN is_public_api INTEGER allow_roaming INTEGER allowed_network_types INTEGER is_visible_in_downloads_ui INTEGER bypass_recommended_size_limit INTEGER mediaprovider_uri TEXT deleted BOOLEAN errorMsg TEXT ''' for rec in self._read_table(table_name): try: if ('notificationpackage' in rec.Keys and rec['notificationpackage'].Value != 'com.android.browser'): continue if (self._is_empty(rec, '_id', 'title') or self._is_duplicate(rec, '_id')): continue downloads = model_browser.DownloadFile() downloads.id = rec['_id'].Value if self._is_url(rec, 'uri'): downloads.url = rec['uri'].Value downloads.filename = rec['title'].Value downloads.filefolderpath = self._convert_nodepath( rec['_data'].Value) downloads.totalsize = rec['total_bytes'].Value # downloads.createdate = rec['modify_time'].Value downloads.donedate = rec['lastmod'].Value # costtime = downloads.donedate - downloads.createdate # downloads.costtime = costtime if costtime > 0 else None downloads.owneruser = self.cur_account_name downloads.source = self.cur_db_source if rec.IsDeleted: downloads.deleted = 1 else: downloads.deleted = rec[ 'deleted'].Value if 'deleted' in rec.Keys else 0 self.csm.db_insert_table_downloadfiles(downloads) except: exc() self.csm.db_commit()