Giter Club home page Giter Club logo

knugihk / whatsapp-chat-exporter Goto Github PK

View Code? Open in Web Editor NEW
455.0 10.0 60.0 588 KB

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.

Home Page: https://wts.knugi.dev/

License: MIT License

Python 92.20% HTML 7.80%
whatsapp whatsapp-export whatsapp-database android ios iphone whatsapp-database-parser parsing whatsapp-chat-exporter whatsapp-conversations

whatsapp-chat-exporter's Introduction

whatsapp-chat-exporter's People

Contributors

andrp92 avatar asla9709 avatar gocomputing avatar knugihk avatar nahoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whatsapp-chat-exporter's Issues

Crash when content id is not found

When you have Whatsapp and migrate to Whatsapp business or the opposite, some records will lose its ids and python doesn't like it here.

Traceback (most recent call last):65)
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/runpy.py", line 198, in _run_module_as_main return _run_code(code, main_globals, None,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/runpy.py", line 88, in _run_code exec(code, run_globals)
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module> cli.main()
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run()
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__")
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals,
File "/.vscode/extensions/ms-python.python-2023.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals)
File "/WhatsApp-Chat-Exporter/Whatsapp_Chat_Exporter/__main__.py", line 382, in <module> main() File "/Whatsapp_Chat_Exporter/__main__.py", line 305, in main messages(db, data, args.media)
File "/dev/itunes-backup/.venv/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/extract_iphone.py", line 93, in messages path = f'{media_folder}/Media/Profile/{_id.split("@")[0]}' ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

OSError: [Errno 22] Invalid argument (Negative timestamp on iOS)

I have the below error while extracting data for an iPhone backup:

File "C:\Users\[user]\AppData\Local\Programs\Python\Python39\lib\site-packages\Whatsapp_Chat_Exporter\extract_iphone.py", line 69, in messages
    "time": datetime.fromtimestamp(ts).strftime("%H:%M"),
OSError: [Errno 22] Invalid argument

To make it clear, some media files were extracted already.

sqlite3.OperationalError: Could not decode to UTF-8 column 'data' with text

Hello,
I suspect that this is due to some of the database not being in UTF-8.
I got around this on another program that also exports Whatsapp messages by adding the following code:
db.text_factory = lambda b: b.decode(errors = 'ignore')
after this code which was already there,
db = sqlite3.connect(file_path)
But when I tried to do this in this program,
I couldn't find It in the extract python files.
I instead found,
this....

if os.path.isfile(contact_db):
    with sqlite3.connect(contact_db) as db:
        contacts(db, data)
if os.path.isfile(msg_db):
    with sqlite3.connect(msg_db) as db:
        messages(db, data)
        media(db, data, media_folder)
        vcard(db, data)
    create_html(data, output_folder)

Which is beyond my understanding.

Problem with contact's names or fallbacks

When trying to export the backup I receive the following message:

image

UnboundLocalError: cannot access local variable 'name' where it is not associated with a value

Please, what can I do about it?

Thanks in advance...

no such table: messages

Gathering contacts...(39)
Traceback (most recent call last):
File "c:\users\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\AppData\Local\Programs\Python\Python37-32\Scripts\wtsexporter.exe_main
.py", line 7, in
File "c:\users\appdata\local\programs\python\python37-32\lib\site-packages\Whatsapp_Chat_Exporter_main
.py", line 167, in main
messages(db, data)
File "c:\users\appdata\local\programs\python\python37-32\lib\site-packages\Whatsapp_Chat_Exporter\extract.py", line 195, in messages
c.execute("""SELECT count() FROM messages""")
sqlite3.OperationalError: no such table: messages

I got the above error while trying to view messages. Please help to fix it.

result of wtsexporter -i -b

Dear KnugiHK, I also tested with iPhone backup from README, and it turned out working fine, again, great project it is! I also noticed there's Media folder in Message folder, and I wonder what's the logic of (0 b d) folders in (************@s.whatsapp.net) folder?
also I noticed TODO 2. Reply in iPhone, may I know more detail description of this feature?

Media is not supported

it seems like all my media/data files are not supported.
I try to extract media from unencrypted iphone backup, the media folder is extracted and there is access to the media.
but the html files don't any media or link path for the media.
(the backup date is 03.2022)

feature request: export 64-digit encryption key

Hello,
I have a feature request.
Would it be possible to output / export the 64-digit encryption key so that I can import an E2E encrypted backup?

This is the use case:
I forgot my password for the E2E encrypted backup and did not save the 64-digit encryption key.

I wanted to update my phone to a new LineageOS version, so I backed up Whatsapp and then deleted all partitions.
I also made a backup of the Whatsapp folder in /data/data, so I still have encrypted_backup.key as a file.

The export also works without problems, but unfortunately Whatsapp does not seem to accept this non-encrypted database; at least when I reinstalled Whatsapp, I was not offered a restore with it.

Adding charset meta tag into the template file

@flansch mentioned the following in issue #9:

When opening the files in Safari on Mac the encoding is not detected properly and emojis and german umlauts are not displayed correctly.
By adding to the head section of one of the files, I was able to fix that. Could you please automatically add this tag.

Bash command not found on linux

I am on Arch linux with Python 3.10.9

After successfully installing with pip install whatsapp-chat-exporter I tried running wtsexport and python -m wtsexport, but I can't find anything..

I have a different goal - how could I reuse this software?

Hi,
I bought an iPhone SE 2022 for my daughter but when I did the migration from Android to iPhone with the iOS data migrator tool, WhastApp wasn't transferred at all. I tried twice, with no luck. I therefore downloaded and purchased AnyTrans, which actually moved WA DB from Android to iPhone, but I see that all the WA pictures are shown in Photos with the date of the transfer and not with the date of when they were received originally.
Since there are thousand of pictures, I cannot manually change the timestamp in Photos, so I was thinking of taking the DB from the iPhone backup, and change the timestamp within the DB - I hope the timestamp of the message and of the image are stored there.
If I can do this job succesfully, I would then need to resend this file to the iPhone, and I wonder:

  1. do you know the DB structure of WA, so that I can check in advance if I can change the timestamp?
  2. How can I send the DB back to the iPhone?

Thanks!
Luca

Wrong media directory name?

I'm using the "dev version".

with:
wtsexporter -i -b /Users/<USERNAME>/Library/Application\ Support/MobileSync/Backup/<ID>/

it creates these directories:

  • results
    • Message
      • Media
      • vCards
  • Message
    • Media
    • vCards

But the HTML file inside results directory refer to Whatsapp directory and not Message directory so no media content (audio/photo/video) are displayed. Renaming Whatsapp in Message solve the problem.

Example:
<img src="WhatsApp/Avatars/[email protected]" onerror="this.style.display='none'">

Is this a bug or I done something wrong?

Can't decrypt because "Dependencies of decrypt_backup and/or extract_encrypted_key are not present."

Hi,
I installed all the required dependencies for extracting the crypt15 databases. When I try to use the following command in the CLI:
wtsexporter -a -k <key> -b ./msgstore.db.crypt15
I get the following output:
Decryption key specified, decrypting WhatsApp backup... Dependencies of decrypt_backup and/or extract_encrypted_key are not present. For details, see README.md.

I have gone through the readme some times and cannot find anything related to this error, maybe I am just not finding the correct part

Thank you :)

Offset reporting and FileNotFoundError

Decryption key specified, decrypting WhatsApp backup...
Common offsets are not applicable to your backup. Trying to brute force it...
The offsets of your IV and database are 67 and 193, respectively. To include your offsets in the program, please report it by creating an issue on GitHub: https://github.com/KnugiHK/Whatsapp-Chat-Exporter/issues/new
Traceback (most recent call last):
File "/home/berkut/.local/bin/wtsexporter", line 8, in
sys.exit(main())
File "/home/berkut/.local/lib/python3.10/site-packages/Whatsapp_Chat_Exporter/main.py", line 124, in main
error = extract.decrypt_backup(db, key, msg_db, crypt)
File "/home/berkut/.local/lib/python3.10/site-packages/Whatsapp_Chat_Exporter/extract.py", line 170, in decrypt_backup
with open(output, "wb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'msgstore.db'

KeyError: 1152562 Dev Branch

Hello,
I tried to use the dev branch to export so that I could bypass the #44 issue but now I have this.
I installed using pip install git+https://github.com/KnugiHK/Whatsapp-Chat-Exporter.git@dev.

Traceback (most recent call last):
  File "/home/user/.local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.9/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 241, in main
    media(db, data, args.media)
  File "/home/user/.local/lib/python3.9/site-packages/Whatsapp_Chat_Exporter/extract.py", line 439, in media
    data[content["key_remote_jid"]].messages[content["message_row_id"]].media = True
KeyError: 1152562

Provide reasons for "message not supported"

Description

Hi,
WhatsApp meta messages like:

  • Chat is end-to-end encrypted...
  • This message was deleted

are currently treated as "This message is not supported".

As noted in this comment, it's not a bug:
#9 (comment)

Metadata is also treated as messages in the database. But since it is not the main focus when it comes to exporting chats, metadata may show as "not supported" unless handled like changes of the group name. Therefore, I will consider it not a bug if the chat is complete.

This is mostly fine, but can cause concern among users thinking some messages are missing (and not everyone searches Github to find the issue).

Suggestion

I suggest additionally providing the reason why the message is not supported (e.g. deleted message or whatsapp internal message) instead of the generic comment that the message is not supported.
This will make it clear that the message is not important.

It would be useful to alleviate the concerns of missing messages if looking through the backup at a later time.

You do detect that these messages are unsupported, so if individually detecting the type is infeasible, an option would also be to make the message less intimidating:
A Whatsapp internal message (phone changed, deleted messages, ...) is not supported

No such table messages

i got this error while exporting chats.

Gathering contacts...(187)
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users*****\Desktop\Whatsapp-Chat-Exporter-0.8.5\Whatsapp_Chat_Exporter\wtsexporter.exe_main
.py", line 7, in
File "C:\Users*****\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\Whatsapp_Chat_Exporter_main
.py", line 174, in main
messages(db, data)
File "C:\Users*******\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\Whatsapp_Chat_Exporter\extract.py", line 194, in messages
c.execute("""SELECT count() FROM messages""")
sqlite3.OperationalError: no such table: messages

Suggestion

I see some of your programming constraints make in interrupt prematurely.

  • Like an instance where it could not find WhatsApp directory and interrupts. What I suggest you do is in your init.py or main.py you first write some checks and if required make those directories.
import os
if(not os.path.isdir('WhatsApp'):
   os.mkdir('WhatsApp')
Traceback (most recent call last):
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Yuvraj\AppData\Local\Programs\Python\Python39\Scripts\wtsexporter.exe\__main__.py", line 7, in <module>
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\site-packages\Whatsapp_Chat_Exporter\__main__.py", line 122, in main
    vcard(db, data)
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\site-packages\Whatsapp_Chat_Exporter\extract.py", line 244, in vcard
    os.mkdir(base)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'WhatsApp/vCards'
  • Avoid permission denied: You can wait for some time before deleting the folder so that it gets free from any process using it.
import time
time.sleep(3)
Gathering vCards...(67/67)
Traceback (most recent call last):
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 806, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'WhatsApp' -> 'result/WhatsApp'
  • Still better for any non crucial operation like deleting temp folders do that in
try:
   # to delete folder
except:
   pass

because your code cascades into being totally dead on an exception

Traceback (most recent call last):
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 806, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'WhatsApp' -> 'result/WhatsApp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Yuvraj\AppData\Local\Programs\Python\Python39\Scripts\wtsexporter.exe\__main__.py", line 7, in <module>
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\site-packages\Whatsapp_Chat_Exporter\__main__.py", line 126, in main
    shutil.move(options.media, f"{options.output}/")
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 818, in move
    rmtree(src)
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 740, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "c:\users\yuvraj\appdata\local\programs\python\python39\lib\shutil.py", line 620, in _rmtree_unsafe
    os.rmdir(path)
OSError: [WinError 145] The directory is not empty: 'WhatsApp'

Re-using already existing DOMs for reply feature.

Hi there,
currently the output html is already supporting direct links to a cited message.
I'd like to suggest the feature to also show the cited message itself as we know it from Whatsapp.
Is there any html support for re-using/displaying already existing DOM element (the original / cited message) instead of having to creating a copy of the message's value and icnreasing the html's file size? Is "href" doing the job?

wtsexporter -a error under wakbe/extracted folder

wtsexporter -a
Traceback (most recent call last):
File "/usr/local/bin/wtsexporter", line 11, in
load_entry_point('whatsapp-chat-exporter==0.6', 'console_scripts', 'wtsexporter')()
File "/home/beckibox/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/beckibox/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2843, in load_entry_point
return ep.load()
File "/home/beckibox/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2447, in load
return self.resolve()
File "/home/beckibox/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2453, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "", line 969, in _find_and_load
File "", line 954, in _find_and_load_unlocked
File "", line 896, in _find_spec
File "", line 1147, in find_spec
File "", line 1123, in _get_spec
File "", line 1104, in _legacy_get_spec
File "", line 444, in spec_from_loader
File "", line 541, in spec_from_file_location
File "/usr/local/lib/python3.5/dist-packages/whatsapp_chat_exporter-0.6-py3.5.egg/Whatsapp_Chat_Exporter/main.py", line 11
parser = OptionParser(version=f"Whatsapp Chat Exporter: {version}")
^
SyntaxError: invalid syntax

Please let me know what am I missing?

See only media (photos, videos, gif, audio etc.) in the html and no text conversations

Hi there,

Is there a way to quickly process the resultant html so that all the normal conversation text is removed, and only the media (such as photos, videos, gif, audio etc.) alone is present? I basically want something like the "Media, links, and docs" feature of the original WhatsApp app where one can quickly scroll up and down the media alone.

I no longer have the decrypted DB handy, so I am looking for a way to post process your result html and strip away the text and keep only the media. Is there a quick way/hack to do this?

WhatsApp failed to restore my DB and this tool has been great at retrieving my memories in a coherent way! Thanks a lot for your work!

Error exporting iPhone backup from windows with Python 3.10.4

I'm getting this error (Python 3.10.4):

c:\Users\myusername\Desktop\working_wts>wtsexporter -i -b "C:\Users\myusername\AppData\Roaming\Apple Computer\MobileSync\Backup\myid"
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Python310\Scripts\wtsexporter.exe_main
.py", line 4, in
File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter_main
.py", line 2, in
from Whatsapp_Chat_Exporter import extract, extract_iphone
File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter\extract.py", line 7, in
import requests
ModuleNotFoundError: No module named 'requests'

Recreate HTML from an already exported db

Is it possibile to run wtsexporter over an already exported backup?

I would like to re-create the HTML in the future when new features are going to be implemented.

impossible to create a file it already exists

Hello and thank you for your work!

I'm getting this error, now:

c:\Users\MYUSER\Desktop\PARA\1_Progetti\wabackup\working_wts>wtsexporter -i -b "C:\Users\MYUSER\AppData\Roaming\Apple Computer\MobileSync\Backup\MYID"
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Python310\Scripts\wtsexporter.exe_main
.py", line 7, in
File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter_main
.py", line 157, in main
extract_iphone_media.extract_media(options.backup)
File "C:\Python310\lib\site-packages\Whatsapp_Chat_Exporter\extract_iphone_media.py", line 118, in extract_media
os.mkdir(destination)
FileExistsError: [WinError 183] Impossibile creare un file, se il file esiste già: 'Message/Media/[email protected]/A'

"Impossibile creare un file, se il file esiste già" means: "Impossible to create a file, it already exists"

unable to open database file

Hey, thank you a lot for the work! I got an error running the script, maybe someone can help me with this:

Running the command wtsexporter -i -b "~/Library/Application Support/MobileSync/Backup/00008110-000C59623ABA801E" I get the following traceback:

Traceback (most recent call last):
  File "/Users/tabea/Desktop/whatsappExporterEnv/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/tabea/Desktop/whatsappExporterEnv/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/[main.py](https://main.py/)", line 271, in main
    extract_iphone_media.extract_media(args.backup)
  File "/Users/tabea/Desktop/whatsappExporterEnv/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/extract_iphone_[media.py](https://media.py/)", line 65, in extract_media
    if is_encrypted(base_dir):
       ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tabea/Desktop/whatsappExporterEnv/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/extract_iphone_[media.py](https://media.py/)", line 50, in is_encrypted
    with sqlite3.connect(os.path.join(base_dir, "Manifest.db")) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file

The backup is not encrypted. Navigating to cd ~/Library/Application\ Support/MobileSync/Backup/00008110-000C59623ABA801E (adding a \ to escape the white space, otherwise the same path as in the original command) I arrive in the backup folder containing, amongst other files, the expected manifest.db:

image

I copied that file to the desktop and opened it using sqlitebrowser. It showed two tables and three indices.
So Manifest.db is in the expected place and after copying it I was able to open it. That makes me think something is off with the path that I pass to your script or that it doesn't have permissions to read that folder? Any ideas on next steps are much appreciated!

Error on decrypt empty password

b=iOSbackup(udid="00008030-0012742811E3802E", backuproot="C:\\Users\\edlon.sa\\Apple\\MobileSync\\Backup")
Traceback (most recent call last): 
File "<stdin>", line 1, in <module>
File "C:\Users\edlon.sa\AppData\Roaming\Python\Python310\site-packages\iOSbackup\__init__.py", line 190, in __init__ 
self.unlockKeys()
File "C:\Users\edlon.sa\AppData\Roaming\Python\Python310\site-packages\iOSbackup\__init__.py", line 1162, in unlockKeys
k = iOSbackup.AESUnwrap(self.decryptionKey,classkey[b"WPKY"])
File "C:\Users\edlon.sa\AppData\Roaming\Python\Python310\site-packages\iOSbackup\__init__.py", line 1214, in AESUnwrap
B = AES.new(key, AES.MODE_ECB).decrypt(todec)
File "C:\Python\Python310\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "C:\Python\Python310\lib\site-packages\Crypto\Cipher\__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "C:\Python\Python310\lib\site-packages\Crypto\Cipher\_mode_ecb.py", line 216, in _create_ecb_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "C:\Python\Python310\lib\site-packages\Crypto\Cipher\AES.py", line 92, in _create_base_cipher
if len(key) not in key_size:
TypeError: object of type 'NoneType' has no len()

Feature request: decrypt wa.db.crypt1*

Hi,
I tried to modify the script to use the key for decrypting the wa db but could not get it to work.
I think there is a whole offset business that I have no clue about.
Would it be an easy dev for you?
Thanks again for the tool!

Error while decompressing

I'm getting the same error each time I try to use to decrypt.
zlib.error: Error -3 while decompressing data: incorrect header check

Seems it could decrypt it but when decompressing it fails. Do you know what could be the issue here?

Feature Request: add ignore argument

Hello,
I am request an ignore argument that ignores the errors and tries extract whatever the program can extract.
Why: It is useful in #45 and #44 as well as in other places where the program errors out.
Thank you.

Standalone Binary Release

@ericsia requested to release standalone binary of the exporter in #22.

I wish it is .txt too. Anyway, is it possible you pack the python script become executable (.exe)? it will be more convenient

Error: sqlite3.DatabaseError: file is not a database

Got this error with Android database:

Error messages:

one@ss3:~/Dropbox/working_wts$ wtsexporter -a
Everything is done!    

one@ss3:~/Dropbox/working_wts$ wtsexporter -a key -b msgstore.db.crypt14
Traceback (most recent call last):
  File "/home/one/.local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())                                                                                      
  File "/home/one/.local/lib/python3.8/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 120, in main
    messages(db, data)
  File "/home/one/.local/lib/python3.8/site-packages/Whatsapp_Chat_Exporter/extract.py", line 41, in messages
    c.execute("""SELECT count() FROM messages""")          
sqlite3.DatabaseError: file is not a database  

link to not supported files

Hello,

I saw the notice if an attachment is not supported (example PDF).

The file cannot be displayed here, however it should be located at <<path>>

How about add to the notice a relative local link to that file so at least is a click away from being opened?

Avoiding in this way to copy and past the path or find it manually.

Move/Convert media to "usual" structure

There's some tool or script that may move or convert all the media to a normal single-folder structure?

I would like to backup my whatsapp media mainly for the images/videos of my family, but the current mixed files inside "random" folders are horrible to do this.
Since all the filenames are hashed and don't seems to have any metadata related to the date the media was sent, I can't see an easy way to achieve this.

If there's nothing already created to achieve this, I think will try to create some script to read the HTML or JSON, then search for the media tags, then copy to a custom folder and rename with the "date_sent" or something like this!

TypeError: Object of type ChatStore is not JSON serializable

Hello, I got this error when running the current 'message_table' branch with '--json' option:

...
Gathering media...(4301/4301)
Gathering vCards...(6/6)
Copying media directory...
Traceback (most recent call last):
  File "/usr/local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
  File "/home/tomtom/.local/lib/python3.8/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 222, in main
    data = json.dumps(data)
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ChatStore is not JSON serializable

Avatars in the html

Hello I noticed in the html source this:

<div class="w3-row">
    <div class="w3-col m2 l2"><img src="[WhatsApp/Avatars/[email protected]](view-source:file:///Users/username/Downloads/whatsapp-chat-exporter/working_wts/result/WhatsApp/Avatars/[email protected])" onerror="this.style.display='none'"></div>
    <div class="w3-col m10 l10">
        <div style="text-align: left;">
	    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales tincidunt leo vel tempus. Nunc justo nibh, dictum et lorem non, pulvinar consequat orci. Duis euismod hendrerit tortor, ut iaculis libero tempor id. Ut volutpat, nulla vitae interdum tristique, massa sapien luctus lectus, sed porttitor ex metus a dui.					
        </div>
    </div>
</div>

But in my iOS db export I can't find the Avatars directory.

sqlite3.DatabaseError: authorization denied

Running the exporter returns the following error:

Traceback (most recent call last):
  File "/Users/p/Library/Python/3.9/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
  File "/Users/p/Library/Python/3.9/lib/python/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 271, in main
    extract_iphone_media.extract_media(args.backup)
  File "/Users/p/Library/Python/3.9/lib/python/site-packages/Whatsapp_Chat_Exporter/extract_iphone_media.py", line 65, in extract_media
    if is_encrypted(base_dir):
  File "/Users/p/Library/Python/3.9/lib/python/site-packages/Whatsapp_Chat_Exporter/extract_iphone_media.py", line 50, in is_encrypted
    with sqlite3.connect(os.path.join(base_dir, "Manifest.db")) as f:
sqlite3.DatabaseError: authorization denied

It's an unencrypted backup, on MacOS.

Trying to opening the Manifest.db using the sqlite3 command does not seem to work. I suspect that may be the cause of the problem (?)

sudo sqlite3 Manifest.db
Password:
Error: unable to open database "Manifest.db": unable to open database file

I have tried deleting the backup, running the backup again, but I seem to get the same errors every time.

Very long vCards filenames

Hello,
I noticed during my nextcloud sync that some vCards filename is very long (NC can't sync files with filename > of 250 characters).

Is it possibile to trim the filenames? If the filenames are needed this long can I delete some vCards?
Am I going to break something in html chats?

Getting error while processing iphone backup

Discussed in #41

Originally posted by ajay-ghub May 16, 2023

> wtsexporter -i -j -b 'path/to/backup'
Gathering contacts...(425)7761)
Gathering messages...(141440/141440)
Gathering media...(31906/31906)
Traceback (most recent call last):
  File "/usr/local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 244, in main
    create_html(
TypeError: create_html() takes from 2 to 5 positional arguments but 6 were given

No such table: messages (Edit: Support for WhatsApp databases with "message" table)

When running the script I get following error message

Gathering contacts...(97)
Traceback (most recent call last):
  File "C:\Users\******\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\******\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\******\AppData\Local\Programs\Python\Python310\Scripts\wtsexporter.exe\__main__.py", line 7, in <module>
  File "C:\Users\******\AppData\Local\Programs\Python\Python310\lib\site-packages\Whatsapp_Chat_Exporter\__main__.py", line 147, in main
    messages(db, data)
  File "C:\Users\******\AppData\Local\Programs\Python\Python310\lib\site-packages\Whatsapp_Chat_Exporter\extract.py", line 88, in messages
    c.execute("""SELECT count() FROM messages""")
sqlite3.OperationalError: no such table: messages

My database doesn't contain the table messages, I only have one called message which contains the data but the schema of the table looks different from what it's supposed to look like.
2022-02-14_22-28-04
What could be the issue here?

Replies in iOS

Hello,

first of all thank you for your work!
Now the request, iphone's "replies" are going to be supported in the near future or I don't have to old my breath?

HTML file does not load fully.

I tried to open one of created HTML file in Google Chrome. HTML file size is around 100 mb. But seems like Chrome cant handle to open that file.

I tried multiple times and i recieved 'Out of Memory' and 'SBOX_FATAL_MEMORY_EXCEEDED' errors from chorme. It exceeds 12 GB ram useage when trying to open HTML file.

Also i tried to not include any whatsapp image media in HTML file with deleting Whatsapp Images directory. But I get same result still HTML file does not fully loads.

Are there any solution for this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.