wa-crypt-tools

Manage WhatsApp .crypt12, .crypt14 and .crypt15 files.

https://github.com/eldavoo/wa-crypt-tools

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: science.org, ieee.org
  • Committers with academic emails
    1 of 11 committers (9.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary

Keywords

android crypt12 crypt13 crypt14 crypt15 python whatsapp whatsapp-backup whatsapp-end-to-end-backup

Keywords from Contributors

interactive mesh interpretability sequences generic projection optim embedded hacking network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

Manage WhatsApp .crypt12, .crypt14 and .crypt15 files.

Basic Info
  • Host: GitHub
  • Owner: ElDavoo
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 4.03 MB
Statistics
  • Stars: 788
  • Watchers: 25
  • Forks: 120
  • Open Issues: 18
  • Releases: 1
Topics
android crypt12 crypt13 crypt14 crypt15 python whatsapp whatsapp-backup whatsapp-end-to-end-backup
Created almost 5 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation Security

README.md

Coverage Status

WhatsApp Crypt Tools

Decrypt and encrypt WhatsApp and WA Business' .crypt12, .crypt14 and .crypt15 files with ease!
For decryption, you NEED the key file or the 64-characters long key.
The key file is named "key" if the backup is crypt14 or
"encrypted_backup.key" if the backup is crypt15 (encrypted E2E backups).
Those who are looking for a more complete suite for WhatsApp forensics, check out whapa.

Quick install

Cloud - Google Colab

If you do not want to install programs in your computer, you can run this program in Google Colab .

Local - Jupyter

If you are familiar with Jupyter (read here if you're not), you can use the notebook version of the program.

Local - pip

You can install this script as a package through pip. Just run: bash python -m pip install wa-crypt-tools for the stable version and bash python -m pip install git+https://github.com/ElDavoo/wa-crypt-tools for the development version.

Quick start

Decrypt a file with wadecrypt

usage: wadecrypt [-h] [-nm] [-bs BUFFER_SIZE] [-nd] [-v] [-f] [keyfile] [encrypted] [decrypted]

So, for decrypting a crypt12/14/15, we give the program the key file, the encrypted file and the name of the output file.

Example

$ wadecrypt encrypted_backup.key msgstore.db.crypt15 msgstore.db key15.py:51 : [I] Crypt15 / Raw key loaded wadecrypt.py:271 : [I] Done

Encrypt a file with waencrypt (BETA)

usage: waencrypt [-h] [-f] [-v] [--enable-features [ENABLE_FEATURES ...]] [--max-feature MAX_FEATURE] [--multi-file] [--type {12,14,15}] [--iv IV] [--reference REFERENCE] [--noparse] [--wa-version WA_VERSION] [--jid JID] [--backup-version BACKUP_VERSION] [--no-compress] [keyfile] [decrypted] [encrypted]

Encryption is more complex and untested: it is advised to use another encrypted file from the same account, which we will call "reference".

With a reference file (only database crypt15 tested)

waencrypt --reference msgstore.db.crypt15 encrypted_backup.key msgstore.db msgstore-new.db.crypt15 waencrypt.py:57 : [W] This script is in beta stage waencrypt.py:89 : [I] Done!

Without a reference file

You need to supply the following parameters:

1) The feature list: Only for 2019+ databases. A list of numbered boolean properties related to your database. There is currently no way to infer them from a database file. In the example, we will just use my backup's feature list, but don't expect it to work for you.
2) The max feature number, which is 39 at the time of writing 3) The version of the app that encrypted the file: Use a reasonable value, like 2.24.8.6 or something.
4) Jid: The last 2 numbers of your phone number
5) Backup version: Use 1.

Defaults will be used if parameters are omitted.

To sum it up: $ waencrypt --enable-features 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 --type 15 --wa-version 2.26.1.2 --jid 00 --backup -version 1 encrypted_backup.key msgstore.db msgstore-new.db.crypt15 waencrypt.py:57 : [W] This script is in beta stage waencrypt.py:89 : [I] Done!

You can get info about a backup file with the wainfo tool.

Tool list

For usage, run the tool with -h option. 1) wacreatekey - Create key files 2) wadecrypt - Decrypt backups 3) waencrypt - Encrypt backups 4) waguess - Hacky way to try decrypt backups 5) wainfo - Get info about a backup

FAQ

Can I decrypt a backup without a key file?

NO! What would be the point of encrypting a file otherwise?

I forgot the password / 64-letters key, can you help me?

See above.

The program doesn't decrypt my backups and says the backups are corrupted

Your backups are corrupted. You can try disabling all checks with the -f flag, but expect crashes and/or unreadable output.

The program doesn't decrypt and says the key is wrong

The key is wrong. You can try disabling all checks with the -f flag, but expect crashes and/or unreadable output.

What is the best setup for decrypting my own databases?

1) Enable end-to-end backups and do NOT use a password, use the 64-letters key option. 2) Use wacreatekey to create a encrypted_backup.key file 3) Store your key file safely and use wadecrypt to decrypt your backups.

In this way, you will manage your own root key - otherwise WhatsApp might change your key when appropriate.

Can I use the password to decrypt the database?

No! The password is only used to talk with the WhatsApp servers and retrieve the 64-letters key.
In other words, the password is used to protect the key, it's not used to encrypt the backups.

Can I decrypt .mcrypt1 files downloaded from Google Drive?

Yes, but the code is not documented, so please at this time read the code.

I really think the program is broken, that my backups are intact and that the key is right

Send me the needed files on Telegram and I will take a look.

If you (understandably) have privacy concerns, open an issue and attach: 1) Output of the program (both with and without --force) 2) Hexdump of keyfile 3) Hexdump of first 512 bytes of encrypted DB

But it will be more difficult to help you.

Where do I get the key(file)?

On a rooted Android device, you can just copy /data/data/com.whatsapp/files/key (or /data/data/com.whatsapp/files/encrypted_backup.key if backups are crypt15).
If you enabled E2E backups, and you did not use a password (you have a copy of the 64-digit key, for example a screenshot), you can just transcribe and use it in lieu of the key file parameter.
There are other ways, but it is not in the scope of this project to tell you.
Issues asking for this will be closed as invalid.

How can I cite this software?

There was no paper or thesis written about this software, but you can cite this online repository. Please don't say "et al." as there is (for now) only one author.

CITATION.cff

See the CITATION.cff file for citation information.

BibTeX

@misc{wa-crypt-tools, author = {ElDavoo}, title = {WhatsApp Crypt Tools}, year = {2022}, month = {06}, howpublished = {\url{https://github.com/ElDavoo/wa-crypt-tools} }

BibLaTeX

@online{wa-crypt-tools, author = {ElDavoo}, title = {WhatsApp Crypt Tools}, year = {2022}, month = {06}, url = {https://github.com/ElDavoo/wa-crypt-tools} }

I will happily accept pull requests for the currently open issues. :)

Last tested version (don't expect this to be updated)

Stable: 2.24.16.76
Beta: 2.24.26.11

Business

Stable:
2.24.23.78

Protobuf automatic fix

You can install the proto optional dependencies to use protoletariat and fix the proto imports automatically.

First, after cloning the repository, do an editable installation of the package (possibily in a virtual environment) with:

pip install -e .[proto]

This will also install the optional dependencies of the package.

Next, download the protobuf compiler from its repository here. You can move the protoc program to the wa-crypt-tools/proto folder where the .proto files are.

Replace the protobuf classes as needed and run protoc to generate the python classes. From the wa-crypt-tools/proto directory of the project, run:

./protoc --python_out=../src/wa_crypt_tools/proto --proto_path=. *.proto

After generating the protobuf python classes through protoc, from that same directory run:

protol --in-place --python-out ..\src\wa_crypt_tools\proto protoc --proto-path=. *.proto

Linux:

PATH="$(pwd):$PATH" protol --in-place --python-out ../src/wa_crypt_tools/proto protoc --proto-path=. *.proto

Now all the generated python classes should have their imports fixed.


Donations

Thank you so much to each one of you! - 🎉🎉🎉 githubsterer 🎉🎉🎉 - 🎉🎉🎉 courious875 🎉🎉🎉
- 🎉 pscriptos 🎉

Anyone else that I forgot to mention!

Credits:

Anyone else that helped!

Research papers that used this software

Stargazers over time

Star History Chart

Owner

  • Name: Davide Palma
  • Login: ElDavoo
  • Kind: user
  • Location: Italy

A constantly sleepy Computer Engineering Student @ University of Modena

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: wa-crypt-tools
message: >-
  Please don't say "et al.", I'm the only author.
type: software
authors:
  - given-names: Davide
    family-names: Palma
    email: posta@davidepalma.it
    orcid: 'https://orcid.org/0000-0003-1931-7836'
repository-code: 'https://github.com/ElDavoo/wa-crypt-tools'
abstract: 'Manage WhatsApp .crypt12, .crypt14 and .crypt15 files.'
keywords:
  - WhatsApp
  - crypt12
  - crypt14
  - crypt15
license: GPL-3.0-only
date-released: '2022-06-01'

GitHub Events

Total
  • Create event: 10
  • Commit comment event: 2
  • Issues event: 23
  • Watch event: 168
  • Delete event: 7
  • Issue comment event: 36
  • Push event: 5
  • Pull request review event: 1
  • Pull request event: 17
  • Fork event: 33
Last Year
  • Create event: 10
  • Commit comment event: 2
  • Issues event: 23
  • Watch event: 168
  • Delete event: 7
  • Issue comment event: 36
  • Push event: 5
  • Pull request review event: 1
  • Pull request event: 17
  • Fork event: 33

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 315
  • Total Committers: 11
  • Avg Commits per committer: 28.636
  • Development Distribution Score (DDS): 0.403
Past Year
  • Commits: 36
  • Committers: 3
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.389
Top Committers
Name Email Commits
David g****b@d****t 188
dependabot[bot] 4****] 59
David d****r@g****m 23
Mikel12455 m****5@g****m 14
EliteAndroidApps E****s 14
Eduardo Santos 4****8 7
David d****a@g****m 6
kingbtcvl 9****l 1
gchem1se g****1@g****m 1
Sebi 1****4 1
AlePaff a****f@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 77
  • Total pull requests: 87
  • Average time to close issues: 17 days
  • Average time to close pull requests: 5 days
  • Total issue authors: 59
  • Total pull request authors: 11
  • Average comments per issue: 5.13
  • Average comments per pull request: 0.3
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 72
Past Year
  • Issues: 16
  • Pull requests: 20
  • Average time to close issues: 9 days
  • Average time to close pull requests: 14 days
  • Issue authors: 12
  • Pull request authors: 2
  • Average comments per issue: 0.75
  • Average comments per pull request: 0.25
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 19
Top Authors
Issue Authors
  • ElDavoo (12)
  • wooooiiiiii2687 (3)
  • xOldeVx (2)
  • 3llomi (2)
  • cleanerspam (2)
  • JSchimmelpfennig (2)
  • code-consensus (2)
  • Missing666z (2)
  • komova-i (1)
  • zacsan (1)
  • FBS11k (1)
  • irainbw (1)
  • DareDreamer (1)
  • ammadanjumch (1)
  • bagaweb (1)
Pull Request Authors
  • dependabot[bot] (88)
  • kingbtcvl (4)
  • gchem1se (4)
  • ElDavoo (2)
  • sebi364 (2)
  • NelisMk7 (2)
  • gzogangzta1 (1)
  • Mikel12455 (1)
  • BurjjKhalifa (1)
  • AlePaff (1)
  • jenspacito (1)
Top Labels
Issue Labels
enhancement (16) good first issue (5) bug (5) low priority (4) invalid (3) info needed (2) help wanted (2) documentation (1) wontfix (1) skill issue (1)
Pull Request Labels
dependencies (88) python (50) github_actions (10)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 981 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: wa-crypt-tools

Manages WhatsApp .crypt12, .crypt14 and .crypt15 files, given the key.

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 981 Last month
Rankings
Dependent packages count: 7.2%
Downloads: 17.8%
Average: 20.2%
Dependent repos count: 35.4%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
requirements.txt pypi
  • javaobj-py3 ==0.4.3
  • protobuf ==4.21.12
  • pycryptodomex ==3.17