mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-25 23:41:33 +00:00
Lower the chunk size for decryption
This commit is contained in:
@@ -246,6 +246,13 @@ def main():
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help="Create a copy of the media seperated per chat in <MEDIA>/separated/ directory"
|
help="Create a copy of the media seperated per chat in <MEDIA>/separated/ directory"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--decrypt-chunk-size",
|
||||||
|
dest="decrypt_chunk_size",
|
||||||
|
default=1 * 1024 * 1024,
|
||||||
|
type=int,
|
||||||
|
help="Specify the chunk size for decrypting iOS backup, which may affect the decryption speed."
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Check for updates
|
# Check for updates
|
||||||
@@ -396,7 +403,7 @@ def main():
|
|||||||
args.media = identifiers.DOMAIN
|
args.media = identifiers.DOMAIN
|
||||||
if args.backup is not None:
|
if args.backup is not None:
|
||||||
if not os.path.isdir(args.media):
|
if not os.path.isdir(args.media):
|
||||||
ios_media_handler.extract_media(args.backup, identifiers)
|
ios_media_handler.extract_media(args.backup, identifiers, args.decrypt_chunk_size)
|
||||||
else:
|
else:
|
||||||
print("WhatsApp directory already exists, skipping WhatsApp file extraction.")
|
print("WhatsApp directory already exists, skipping WhatsApp file extraction.")
|
||||||
if args.db is None:
|
if args.db is None:
|
||||||
|
|||||||
@@ -13,9 +13,15 @@ else:
|
|||||||
support_encrypted = True
|
support_encrypted = True
|
||||||
|
|
||||||
|
|
||||||
def extract_encrypted(base_dir, password, identifiers):
|
def extract_encrypted(base_dir, password, identifiers, decrypt_chunk_size):
|
||||||
print("Trying to decrypt the iOS backup...", end="")
|
print("Trying to decrypt the iOS backup...", end="")
|
||||||
backup = EncryptedBackup(backup_directory=base_dir, passphrase=password, cleanup=False, check_same_thread=False)
|
backup = EncryptedBackup(
|
||||||
|
backup_directory=base_dir,
|
||||||
|
passphrase=password,
|
||||||
|
cleanup=False,
|
||||||
|
check_same_thread=False,
|
||||||
|
decrypt_chunk_size=decrypt_chunk_size
|
||||||
|
)
|
||||||
print("Done\nDecrypting WhatsApp database...", end="")
|
print("Done\nDecrypting WhatsApp database...", end="")
|
||||||
try:
|
try:
|
||||||
backup.extract_file(
|
backup.extract_file(
|
||||||
@@ -64,7 +70,7 @@ def is_encrypted(base_dir):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def extract_media(base_dir, identifiers):
|
def extract_media(base_dir, identifiers, decrypt_chunk_size):
|
||||||
if is_encrypted(base_dir):
|
if is_encrypted(base_dir):
|
||||||
if not support_encrypted:
|
if not support_encrypted:
|
||||||
print("You don't have the dependencies to handle encrypted backup.")
|
print("You don't have the dependencies to handle encrypted backup.")
|
||||||
@@ -73,7 +79,7 @@ def extract_media(base_dir, identifiers):
|
|||||||
return False
|
return False
|
||||||
print("Encryption detected on the backup!")
|
print("Encryption detected on the backup!")
|
||||||
password = getpass.getpass("Enter the password for the backup:")
|
password = getpass.getpass("Enter the password for the backup:")
|
||||||
extract_encrypted(base_dir, password, identifiers)
|
extract_encrypted(base_dir, password, identifiers, decrypt_chunk_size)
|
||||||
else:
|
else:
|
||||||
wts_db = os.path.join(base_dir, identifiers.MESSAGE[:2], identifiers.MESSAGE)
|
wts_db = os.path.join(base_dir, identifiers.MESSAGE[:2], identifiers.MESSAGE)
|
||||||
contact_db = os.path.join(base_dir, identifiers.CONTACT[:2], identifiers.CONTACT)
|
contact_db = os.path.join(base_dir, identifiers.CONTACT[:2], identifiers.CONTACT)
|
||||||
|
|||||||
Reference in New Issue
Block a user