chronicle-imessage 0.2.1 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 708f7221b523605befa9a52e8fd375d79fc2a82109cf55c04fe145d53a1465b7
4
- data.tar.gz: 570cbd92f6c52f8149fbebc18f5f961f314a5e3908983a2ce702ce324d2b88ac
3
+ metadata.gz: 9c6cdfbc6a52ca7ae467378ff36cb35ad24c8a4dcbeee36a3953daab19a8e6e2
4
+ data.tar.gz: 28768a3f6378e7e5c2327cdec73dcdff9bab064f32e9f7c93784e49fac3f249d
5
5
  SHA512:
6
- metadata.gz: e3d7c77e1fe7ee50ab51a4d11566c5c0ab5279b347f1b946c42cb376b6382ed2687af7d0431c5d30ef87bf8bc2c8f58ccf185d2ee5ebd91a99b47af7756ef31d
7
- data.tar.gz: 51ed17c712516215615f964859ba08cb59deeb6a9d91811865e3b8e226bff1e357fafe04a52fd19a0e545dfe05fc4e309bdcc47853be6c177b80a1e319001643
6
+ metadata.gz: e7f1101ccbf489834f48a5bc909758bb6d1d4b0c34a512a4b17b31efcf9d851a0c1d7174e8745b35671df9cd2e9d4b525216e4d2a9800dbb63c16d1047f0432a
7
+ data.tar.gz: 2e8601ef4107929d5ce524e62badaa5b7f16afebb4b7527455ffcf0542b12c4bdc0aee5147bf053f2e505e04593e52f6674127718a174064069bde897564af89
data/README.md CHANGED
@@ -1,18 +1,42 @@
1
1
  # Chronicle::Imessage
2
+ [![Gem Version](https://badge.fury.io/rb/chronicle-imessage.svg)](https://badge.fury.io/rb/chronicle-imessage)
2
3
 
3
- IMessage importer for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl)
4
+ Access your iMessage messages and attachments using the command line with this plugin for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl).
5
+
6
+ ## Usage
7
+
8
+ ```sh
9
+ # Install chronicle-etl and this plugin
10
+ $ gem install chronicle-etl
11
+ $ chronicle-etl plugins:install imessage
12
+
13
+ # Load messages since February 7
14
+ $ chronicle-etl --extractor imessage --transformer imessage --since "2022-02-07"
15
+
16
+ # Of the latest 1000 messages received, who were the top senders?
17
+ $ chronicle-etl -e imessage -t imessage --limit 1000 --no-header-row --fields actor.title | sort | uniq -c | sort -nr
18
+
19
+ # Get the raw query results for the latest 10 messages and save as a CSV
20
+ $ chronicle-etl -e imessage --loader csv --limit 10 -o imessages.csv
21
+ ```
4
22
 
5
23
  ## Available Connectors
6
24
  ### Extractors
7
- - `imessage` - Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
8
25
 
9
- ### Transformers
10
- - `imessage` - Transformer for processing messages into Chronicle Schema
26
+ #### `imessage`
27
+ Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
11
28
 
12
- ## Usage
29
+ ##### Settings
30
+ - `load_attachments`: (default: false) Whether to load message attachments
31
+ - `only_attachments`: (default: fasle) Whether to load only messages with attachments
13
32
 
14
- ```bash
15
- gem install chronicle-etl
16
- chronicle-etl plugins:install imessage
17
- chronicle-etl --extractor imessage --since "2022-02-07" --transformer imessage
18
- ```
33
+ We want messages to have sender/receiver information set properly so we try to infer your iCloud information and phone number automatically. If these fail, you can provide the necessary information with:
34
+ - `my_phone_number`: Your phone number (for setting messages's actor fields properly)
35
+ - `my_name`: Your name (for setting messages's actor fields properly)
36
+ - `icloud_account_id`: Specify an email address that represents your iCloud account ID
37
+ - `icloud_account_dsid`: Specify iCloud DSID
38
+ - Can find in Keychain or by running `$ defaults read MobileMeAccounts Accounts`
39
+ ### Transformers
40
+
41
+ #### `imessage`
42
+ Transform an iMessage message into Chronicle Schema
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
- spec.add_dependency "chronicle-etl", "~> 0.4"
38
+ spec.add_dependency "chronicle-etl", "~> 0.4.4"
39
39
  spec.add_dependency "sqlite3", "~> 1.4"
40
40
  spec.add_dependency "phonelib", "~> 0.6"
41
41
 
@@ -1,6 +1,5 @@
1
1
  require 'chronicle/etl'
2
2
  require 'sqlite3'
3
- require 'pry'
4
3
 
5
4
  module Chronicle
6
5
  module Imessage
@@ -28,8 +27,8 @@ module Chronicle
28
27
  meta = {}
29
28
  meta[:participants] = @chats[message['chat_id']]
30
29
  meta[:attachments] = @attachments[message['message_id']] if @attachments
31
- meta[:my_phone_contact] = @my_phone_contact
32
- meta[:my_icloud_account] = @my_icloud_account
30
+ meta[:my_phone_contact] = @my_phone_contact if @my_phone_contact.values.all?
31
+ meta[:my_icloud_account] = @my_icloud_account if @my_icloud_account.values.all?
33
32
 
34
33
  yield Chronicle::ETL::Extraction.new(data: message, meta: meta)
35
34
  end
@@ -43,10 +42,12 @@ module Chronicle
43
42
 
44
43
  def prepare_data
45
44
  @db = SQLite3::Database.new(@config.db, results_as_hash: true)
45
+ @local_contacts = LocalContacts.new
46
+ @contacts = @local_contacts.contacts
47
+
46
48
  @messages = load_messages
47
49
  @chats = load_chats
48
50
 
49
- @local_contacts = LocalContacts.new
50
51
  @my_phone_contact = load_my_phone_contact(@local_contacts)
51
52
  @my_icloud_account = load_my_icloud_account(@local_contacts)
52
53
 
@@ -57,16 +58,16 @@ module Chronicle
57
58
 
58
59
  def load_my_phone_contact(local_contacts)
59
60
  {
60
- phone_number: @config.my_phone_number || local_contacts.my_phone_contact.fetch(:phone_number),
61
- name: @config.my_name || local_contacts.my_phone_contact.fetch(:full_name)
61
+ phone_number: @config.my_phone_number || local_contacts.my_phone_contact&.fetch(:phone_number),
62
+ name: @config.my_name || local_contacts.my_phone_contact&.fetch(:full_name)
62
63
  }
63
64
  end
64
65
 
65
66
  def load_my_icloud_account(local_contacts)
66
67
  {
67
- id: @config.icloud_account_id || local_contacts.my_icloud_account.fetch(:AccountID),
68
- dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account.fetch(:AccountDSID),
69
- display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account.fetch(:DisplayName)
68
+ id: nil,
69
+ dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account&.fetch(:AccountDSID),
70
+ display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account&.fetch(:DisplayName)
70
71
  }
71
72
  end
72
73
 
@@ -102,7 +102,7 @@ module Chronicle
102
102
  end
103
103
 
104
104
  def build_identity identity
105
- raise ::Chronicle::ETL::UntransformableRecordError.new("Could not build identity", transformation: self) unless identity
105
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing identity data") unless identity
106
106
 
107
107
  record = ::Chronicle::ETL::Models::Entity.new({
108
108
  represents: 'identity',
@@ -125,7 +125,7 @@ module Chronicle
125
125
 
126
126
  def build_identity_mine_icloud
127
127
  icloud_account = @extraction.meta[:my_icloud_account]
128
- raise(UntransformableRecordError, "Missing iCloud account information") unless icloud_account
128
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing iCloud details. Please provide them through the extractor settings.") unless icloud_account
129
129
 
130
130
  record = ::Chronicle::ETL::Models::Entity.new({
131
131
  represent: 'identity',
@@ -140,7 +140,7 @@ module Chronicle
140
140
 
141
141
  def build_identity_mine_phone
142
142
  phone_account = @extraction.meta[:my_phone_contact]
143
- raise(UntransformableRecordError, "Missing own phone contact information") unless phone_account
143
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing phone details. Please provide them through the extractor settings.") unless phone_account
144
144
 
145
145
  record = ::Chronicle::ETL::Models::Entity.new({
146
146
  represent: 'identity',
@@ -31,6 +31,8 @@ module Chronicle
31
31
  @my_icloud_account ||= load_my_icloud_account
32
32
  end
33
33
 
34
+ private
35
+
34
36
  # The synced address book doesn't have a stable folder location so we
35
37
  # have to search for it
36
38
  def find_local_icloud_address_book
@@ -1,5 +1,5 @@
1
1
  module Chronicle
2
2
  module Imessage
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chronicle-imessage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Louis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-12 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronicle-etl
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: 0.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: 0.4.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ metadata:
107
107
  homepage_uri: https://github.com/chronicle-app/chronicle-imessage
108
108
  source_code_uri: https://github.com/chronicle-app/chronicle-imessage
109
109
  changelog_uri: https://github.com/chronicle-app/chronicle-imessage
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.3.9
126
- signing_key:
125
+ rubygems_version: 3.3.3
126
+ signing_key:
127
127
  specification_version: 4
128
128
  summary: iMessage importer for Chronicle
129
129
  test_files: []