Git Product home page Git Product logo

imsg's Introduction

imsg

A utility for fetching data from iMessage on macOS (version 10.14 or above).

The following information is currently being read from the database:

  • sender's or recipient's phone number or email address
  • message's content
  • timestamp
  • service (iMessage or SMS)
  • whether the message was sent by the iMessage account holder

iMessage data

Messages (iMessage or SMS) and attachments are stored in ~/Library/Messages on macOS. This directory contains a chat.db file, which is a SQLite3 database with two interesting tables: handle and message.

  • The handle table contains the recipients (email address or phone number)
  • The received messages are in the message table

Requirements

Install

pip install imsg

Usage

CLI

Note

On macOS, your terminal application needs access to ~/Library in order to read chat.db. Add the application to System Preferences > Privacy & Security > Full Disk Access.

usage: imsg [-h] [-f [DATABASE]] [-e [EXPORT]] [-s [START]] [-u [END]] [-l [LIMIT]] [-r [RECIPIENT]] [-t [SENDER]] [-v]

options:
  -h, --help            show this help message and exit
  -f [DATABASE], --database [DATABASE]
                        path to chat.db, default to ~/Library/Messages/chat.db
  -e [EXPORT], --export [EXPORT]
                        export to file with format (one of: 'c', 'csv', 's', 'sqlite')
  -s [START], --start [START]
                        start date, one of formats: 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DD'
  -u [END], --end [END]
                        end date, one of formats: 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DD'
  -l [LIMIT], --limit [LIMIT]
                        limit number of messages to read
  -r [RECIPIENT], --recipient [RECIPIENT]
                        filter by recipient
  -t [SENDER], --sender [SENDER]
                        filter by sender
  -v, --version         show version

Library

imsg can be used in code as a library. For example:

from imsg import data_access, message

DB_PATH = "/path/to/chat.db"

data: list[message.Message] = data_access.DataAccess(DB_PATH).fetch()
print(data)

imsg's People

Contributors

niftycode avatar khaister avatar xern avatar silasstokes avatar thecircleisround avatar

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.