def main():
	backup_folder = get_backup_folder()
	if backup_folder is None:
		print("Could not find backup folder")
		sys.exit()

	mbdb_file = os.path.join(backup_folder, "Manifest.mbdb")

	files_in_backup = mbdb.process_mbdb_file(mbdb_file)

	whatsapp_chat_file = None
	for f in files_in_backup:
		if f['domain'] == b"AppDomain-net.whatsapp.WhatsApp" and f['filename'] == b"Documents/ChatStorage.sqlite":
			whatsapp_chat_file = f['fileID']

	if whatsapp_chat_file is None:
		print("Could not find WhatsApp Chat file")
		sys.exit()

	whatsapp_chat_file = os.path.join(backup_folder, str(whatsapp_chat_file))
	shutil.copy(whatsapp_chat_file, chat_output.CHAT_STORAGE_FILE)

	chat_output.main()

	os.remove(chat_output.CHAT_STORAGE_FILE)
Esempio n. 2
0
	def __init__(self):
		backup_folder = self._get_backup_folder()
		if backup_folder is None:
			raise Exception("Could not find backup folder")

		mbdb_file = os.path.join(backup_folder, "Manifest.mbdb")

		files_in_backup = mbdb.process_mbdb_file(mbdb_file)

		# file index: map domain+filename to physical file in backup directory
		self.file_index = {}
		for f in files_in_backup:
			domain = str(f['domain'], "ascii")
			filename = str(f['filename'], "ascii")
			file_path = os.path.join(backup_folder, str(f['fileID']))
			self.file_index[(domain, filename)] = file_path
Esempio n. 3
0
	def _get_file_index(self):
		if self._file_index is not None:
			return self._file_index

		mbdb_file = os.path.join(self._dir, "Manifest.mbdb")

		files_in_backup = mbdb.process_mbdb_file(mbdb_file)

		# file index: map domain+filename to physical file in backup directory
		self._file_index = dict()
		for f in files_in_backup:
			domain = f['domain'].decode("utf-8", errors="ignore")
			filename = f['filename'].decode("utf-8", errors="ignore")
			file_path = os.path.join(self._dir, str(f['fileID']))
			self._file_index[(domain, filename)] = file_path
		return self._file_index
    def __init__(self):
        backup_folder = self._get_backup_folder()
        if backup_folder is None:
            raise Exception("Could not find backup folder")

        mbdb_file = os.path.join(backup_folder, "Manifest.mbdb")

        files_in_backup = mbdb.process_mbdb_file(mbdb_file)

        # file index: map domain+filename to physical file in backup directory
        self.file_index = {}
        for f in files_in_backup:
            domain = str(f['domain'], "ascii")
            filename = str(f['filename'], "ascii")
            file_path = os.path.join(backup_folder, str(f['fileID']))
            self.file_index[(domain, filename)] = file_path