imessagedb

Provides access to the iMessage chat.db, including parsing and output

Submodules

Package Contents

Classes

DB

A class to connect to an iMessage database

Functions

convert_to_database_date(→ float)

convert_from_database_date(→ datetime.datetime)

safe_filename(→ str)

_create_default_configuration(→ None)

Generates a default configuration if one is not passed in

_get_contacts(→ dict)

run(→ None)

Run the imessagedb command line

Attributes

__version__

mac_epoch_start

DEFAULT_CONFIGURATION

imessagedb.__version__
class imessagedb.DB(database_name=None, config=None)[source]

A class to connect to an iMessage database

property connection: sqlite3.Cursor

Returns a connection to query the database

property handles: imessagedb.handles.Handles

Returns an imessagedb.Handles class with all the handles

property chats: imessagedb.chats.Chats

Returns an imessagedb.Chats class with all the chats

property attachment_list: imessagedb.attachments.Attachments

Returns an imessagedb.Attachments class with all the attachments

property config: configparser.ConfigParser

Returns the configuration object

property control

Returns a shortcut to the CONTROL section of the configuration

Messages(query_type: str, title: str, numbers: list = None, chat_id: str = None) imessagedb.messages.Messages[source]

A wrapper to create a Messages class

HTMLOutput(me: str, message_list: imessagedb.messages.Messages, inline=False, output_file=None) imessagedb.generate_html.HTMLOutput[source]

A wrapper to create an HTMLOutput class

TextOutput(me: str, message_list: imessagedb.messages.Messages, output_file=None) imessagedb.generate_text.TextOutput[source]

A wrapper to create a TextOutput class

disconnect() None[source]

Disconnects from the database

imessagedb.mac_epoch_start
imessagedb.convert_to_database_date(date_string: str) float[source]
imessagedb.convert_from_database_date(date_value: float) datetime.datetime[source]
imessagedb.safe_filename(filename: str) str[source]
imessagedb.DEFAULT_CONFIGURATION = Multiline-String
Show Value
"""
[CONTROL]

# Whether or not to copy the attachments into a different directory. This is needed for two reasons:
#  1) The web browser does not have access to the directory that the attachments are stored, so it cannot display them
#  2) Some of the attachments need to be converted in order to be viewed in the browser

copy = True

# The directory to put the output. The html file will go in {copy_directory}/{Person}.html,
#   and the attachments will go in {copy_directory}/{Person}_Attachments. If you specify HOME, then
#   it will put it in your home directory

copy directory = HOME

# If the file already exists in the destination directory it is not recopied, but that can be overridden by
#  specifying 'force copy' as true

force copy = False

# 'Skip attachments' ignores attachments

skip attachments = False

# Additional details show some other information on each message, including the chat id and any edits that have
#  been done

additional details = False

# Some extra verbosity if true

verbose = True

[DISPLAY]

# Output type, either html or text

output type = html

# Number of messages in each html file. If this is 0 or not specified, it will be one large file.
#  There may be more messages than this per file, as it splits at the next date change after that number
#  of messages.

split output = 1000

# Inline attachments mean that the images are in the HTML instead of loaded when hovered over

inline attachments = False

# Popup location is where the attachment popup window shows up, and is either 'upper right', 'upper left' or 'floating'

popup location = upper right

# 'me' is the name to put for your text messages
me = Me

# The color for the name in text output. No color is used if 'use text color' is false.
#  The color can only be one of the following options:
#   black, red, green, yellow, blue, magenta, cyan, white, light_grey, dark_grey,
#   light_red, light_green, light_yellow, light_blue, light_magenta, light_cyan

# The way that the color selection works is that it will use the first color on the color list for the first person
#  in the conversation, the second for the second, third for the third, etc. If there are more participants than colors,
#  it will wrap around to the first color.

use text color = True
text color list = red, green, yellow, blue, magenta, cyan
reply text color = light_grey

# The background and name color of the messages in html output
# The options for colors can be found here: https://www.w3schools.com/cssref/css_colors.php

# The way that the color selection works is that it will use the first color on the color list for the first person
#  in the conversation, the second for the second, third for the third, etc. If there are more participants than colors,
#  it will wrap around to the first color.

html background color list = AliceBlue, Cyan, Gold, Lavender, LightGreen, PeachPuff, Wheat
html name color list = Blue, DarkCyan, DarkGoldenRod, Purple, DarkGreen, Orange, Sienna

# The background color of the thread in replies

thread background = HoneyDew


[CONTACTS]

# A person that you text with can have multiple numbers, and you may not always want to specify the full specific
#  number as stored in the handle database, so you can do the mapping here, providing the name of a person,
#  and a comma separated list of numbers

Samantha: +18434676040, samanthasmilt@gmail.com,
   s12ddd2@colt.edu
Abe: +16103499696
Marissa: +14029490739
"""
imessagedb._create_default_configuration(filename: str) None[source]

Generates a default configuration if one is not passed in

imessagedb._get_contacts(configuration: configparser.ConfigParser) dict[source]
imessagedb.run() None[source]

Run the imessagedb command line