{"id":25816420,"url":"https://github.com/niftycode/imessage_reader","last_synced_at":"2025-04-09T22:12:24.819Z","repository":{"id":41492061,"uuid":"191938587","full_name":"niftycode/imessage_reader","owner":"niftycode","description":"Fetch imessages from chat.db","archived":false,"fork":false,"pushed_at":"2024-01-21T23:45:09.000Z","size":109,"stargazers_count":103,"open_issues_count":3,"forks_count":21,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T18:53:49.535Z","etag":null,"topics":["forensics","imessage","imessage-reader","macos","python3","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niftycode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-14T12:22:18.000Z","updated_at":"2025-04-01T20:18:05.000Z","dependencies_parsed_at":"2025-02-28T05:50:39.067Z","dependency_job_id":"58b59a11-3590-46a1-a903-1ee6eea78a29","html_url":"https://github.com/niftycode/imessage_reader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niftycode%2Fimessage_reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niftycode%2Fimessage_reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niftycode%2Fimessage_reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niftycode%2Fimessage_reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niftycode","download_url":"https://codeload.github.com/niftycode/imessage_reader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forensics","imessage","imessage-reader","macos","python3","sqlite3"],"created_at":"2025-02-28T05:33:25.427Z","updated_at":"2025-04-09T22:12:24.798Z","avatar_url":"https://github.com/niftycode.png","language":"Python","readme":"# imessage_reader\n\n![](img/license-MIT-green.svg) ![](img/python-3.9-blue.svg) ![](https://img.shields.io/github/last-commit/niftycode/imessage_reader.svg?style=flat) ![](https://img.shields.io/github/issues/niftycode/imessage_reader.svg?style=flat)  ![](https://img.shields.io/pypi/v/imessage_reader)\n\nThis is a forensic tool written in Python 3. Use this tool to fetch the content (phone numbers, email addresses, messages and the account) from the *chat.db* database file on **macOS** (version 10.14 or above).\n\nThe following information is currently being read from the database:\n\n* user id (sender's or recipient's phone number or email address)\n* message\n* date and time\n* service (iMessage or SMS)\n* account (destination caller id)\n* is the message from me\n\n## Background\n\nReceived messages (iMessage or SMS) and attachments will be saved in \"~/Library/Messages\". This directory contains a \"chat.db\" file (SQLite3) with two tables of interest: *handle* and *message*. The *handle* table contains the recipients (email address or phone number). The received messages are in the *message* table.\n\n## Note\n\nOf course, the chat.db file is only created under macOS. Nevertheless, this program can also be used under Linux. In contrast to use under macOS, the path to the chat.db file must then be specified (see below).\n\n## Requirements\n\n* Python 3.9+\n* openpyxl\n\nTo run tests install **pytest**:\n\n    pip3 install pytest\n\n## Install\n\n    pip3 install imessage-reader\n\n## Usage (CLI)\n\n## Specify no options\n\nStart the program with:\n\n    imessage_reader\n\nThis will show you all users and messages in the Terminal. If no option (`-p \u003cPATH\u003e`) is specified, the default directory (under macOS) is searched for the chat.db file.\n\n## Specify a PATH as argument\n\nA different path to chat.db file can be specified with the `-p` option:\n\n    imessage_reader -p \u003cPATH\u003e\n\nUnless the `-o` option is also used, the data is displayed in the Terminal.\n\n## Specify an output argument\n\nYou can create an Excel file containing users, messages, date and service (SMS or iMessage). The file will be stored in the\nDocuments folder:\n\n    imessage_reader -o e\n\nor\n\n    imessage_reader -o excel\n\nYou can create a SQLite3 database containing users, messages, date and service (SMS or iMessage). The file will be stored in the Documents folder:\n\n    imessage_reader -o s\n\nor\n\n    imessage_reader -o sqlite\n\nIf you only want to see a list of recipients use:\n\n    imessage_reader -r\n\nor\n\n    imessage_reader --recipients\n\n**Note**: On **macOS** you need access to the *Library* folder in order to read the iMessage database file (\"chat.db\"). You can add access (for *Terminal* or *iTerm*) in\n\n    \u003e System Preferences \u003e Security \u0026 Privacy \u003e Privacy \u003e Full Disk Access\n\n## Specify a PATH and an output argument\n\nYou can combine the `-p` with the `-o` option:\n\n    imessage_reader -p /home/bodo/Downloads -o excel\n\nIn this example the chat.db file is located in the Downloads folder (on a Linux machine). And the Excel file will be created in the Documents folder.\n\n## Usage (import module)\n\nTo get the messages use following code:\n\n    from imessage_reader import fetch_data\n    \n    DB_PATH = /home/bodo/Downloads/chat.db\n    \n    # Create a FetchData instance\n    fd = fetch_data.FetchData(DB_PATH)\n\n    # Store messages in my_data\n    # This is a list of tuples containing user id, message and service (iMessage or SMS).\n    my_data = fd.get_messages()\n    print(my_data)\n\n## ToDo\n\n* ~~Get the date of messages~~\n* ~~Fetch the date of received messages.~~\n* ~~Show a list of all known recipients.~~\n* ~~Did the user receive the message via SMS or via iMessage?~~\n* ~~Create SQLite3 database.~~\n* ~~Specify a different path to the chat.db file.~~\n* Show attachments.\n* Add more tests.\n\n## Changelog\n\nsee [CHANGELOG.rst](https://github.com/niftycode/imessage_reader/blob/master/CHANGELOG.rst)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniftycode%2Fimessage_reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniftycode%2Fimessage_reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniftycode%2Fimessage_reader/lists"}