idb 2.9.3 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gui/app_details_group_box.rb +1 -1
- data/lib/gui/app_list_dialog.rb +1 -1
- data/lib/gui/default_protection_class_group_widget.rb +1 -1
- data/lib/idb.rb +1 -1
- data/lib/idb/version.rb +1 -1
- data/lib/lib/app.rb +46 -11
- data/lib/lib/device.rb +15 -1
- data/lib/lib/ios10_application_state_db_wrapper.rb +83 -0
- data/lib/lib/ssh_operations.rb +9 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4130d3094c841da7617c5136e633a1db05763f17
|
4
|
+
data.tar.gz: 1ff56befe28f80b90b5cab55bd8d630cf13075b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a3aa79dfe0011c12de8354353d98fbe4535e8459aa59a139bbbe776727466eb8c3d98a2877212fb3f51155cf6e9ca56fd34f983e495bc69b9087e2229a3cfca
|
7
|
+
data.tar.gz: 9c29f6ee4927e8b9cb33bbd6edf1f9fb3c927d6bb5bfd2ae034f20b440fb27a2ee083aedd2a80495e66e5ef9fa0e1177b34d828bd8e858c514ea713c2b13e0e0
|
data/Gemfile.lock
CHANGED
@@ -134,7 +134,7 @@ module Idb
|
|
134
134
|
if $device.ios_version < 8
|
135
135
|
add_detail 'application-identifier', 'Only available for iOS 8+'
|
136
136
|
else
|
137
|
-
$selected_app.
|
137
|
+
$selected_app.entitlements.each do |x|
|
138
138
|
add_detail x[0].to_s, x[0].to_s
|
139
139
|
@vals[x[0].to_s].setText(x[1].to_s)
|
140
140
|
end
|
data/lib/gui/app_list_dialog.rb
CHANGED
@@ -38,7 +38,7 @@ module Idb
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def refresh_app_list
|
41
|
-
if $device.ios_version >= 8
|
41
|
+
if $device.ios_version >= 8 && $device.ios_version != 10
|
42
42
|
refresh_msg = "Refreshing uicache to ensure app information is" \
|
43
43
|
"up-to-date. This may take a few seconds."
|
44
44
|
box = Qt::MessageBox.new 1, "Refreshing...", refresh_msg
|
@@ -20,7 +20,7 @@ module Idb
|
|
20
20
|
if $device.ios_version < 8
|
21
21
|
@val.setText "Only available for iOS 8+"
|
22
22
|
else
|
23
|
-
$selected_app.
|
23
|
+
$selected_app.entitlements.each do |x|
|
24
24
|
if x[0].to_s == "com.apple.developer.default-data-protection"
|
25
25
|
@val.setText x[1].to_s
|
26
26
|
end
|
data/lib/idb.rb
CHANGED
@@ -213,7 +213,7 @@ module Idb
|
|
213
213
|
$log.info "Device not seen before. Opening status page."
|
214
214
|
error = Qt::MessageBox.new self
|
215
215
|
error.setInformativeText("This device has not been configured yet. Opening Status page to verify all required tools are installed on the device.")
|
216
|
-
error.setIcon(Qt::MessageBox::Warning)
|
216
|
+
#error.setIcon(Qt::MessageBox::Warning)
|
217
217
|
error.exec
|
218
218
|
@device_status = DeviceStatusDialog.new
|
219
219
|
@device_status.exec
|
data/lib/idb/version.rb
CHANGED
data/lib/lib/app.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative 'plist_util'
|
|
2
2
|
require_relative 'app_binary'
|
3
3
|
require_relative 'CgBI'
|
4
4
|
require_relative 'ios8_last_launch_services_map_wrapper'
|
5
|
+
require_relative 'ios10_application_state_db_wrapper'
|
5
6
|
|
6
7
|
module Idb
|
7
8
|
class App
|
@@ -19,16 +20,21 @@ module Idb
|
|
19
20
|
|
20
21
|
parse_info_plist
|
21
22
|
|
22
|
-
|
23
|
+
|
24
|
+
if $device.ios_version >= 10
|
25
|
+
@services_map = IOS10ApplicationStateDbWrapper.new
|
26
|
+
@data_dir = @services_map.data_path_by_bundle_id @info_plist.bundle_identifier
|
27
|
+
|
28
|
+
elsif $device.ios_version >= 8
|
23
29
|
if $device.ios_version == 8
|
24
30
|
mapping_file = "/var/mobile/Library/MobileInstallation/LastLaunchServicesMap.plist"
|
25
31
|
else
|
26
32
|
mapping_file = "/private/var/installd/Library/MobileInstallation/LastLaunchServicesMap.plist"
|
27
33
|
end
|
34
|
+
|
28
35
|
local_mapping_file = cache_file mapping_file
|
29
36
|
@services_map = IOS8LastLaunchServicesMapWrapper.new local_mapping_file
|
30
37
|
@data_dir = @services_map.data_path_by_bundle_id @info_plist.bundle_identifier
|
31
|
-
@keychain_access_groups = @services_map.keychain_access_groups_by_bundle_id @info_plist.bundle_identifier
|
32
38
|
|
33
39
|
else
|
34
40
|
@data_dir = @app_dir
|
@@ -165,11 +171,24 @@ module Idb
|
|
165
171
|
end
|
166
172
|
|
167
173
|
def keychain_access_groups
|
168
|
-
if
|
169
|
-
"[iOS 8 specific]"
|
170
|
-
|
171
|
-
|
174
|
+
if $device.ios_version < 8
|
175
|
+
"[iOS 8+ specific]"
|
176
|
+
end
|
177
|
+
|
178
|
+
## return stored groups if we have them
|
179
|
+
unless @keychain_access_groups.nil?
|
180
|
+
return @keychain_access_groups.join ("\n")
|
172
181
|
end
|
182
|
+
|
183
|
+
if $device.ios_version >= 10
|
184
|
+
@keychain_access_groups = @services_map.keychain_access_groups_by_binary binary_path
|
185
|
+
end
|
186
|
+
|
187
|
+
if $device.ios_version >= 8
|
188
|
+
@keychain_access_groups = @services_map.keychain_access_groups_by_bundle_id @info_plist.bundle_identifier
|
189
|
+
end
|
190
|
+
|
191
|
+
@keychain_access_groups.join ("\n")
|
173
192
|
end
|
174
193
|
|
175
194
|
def data_directory
|
@@ -203,13 +222,18 @@ module Idb
|
|
203
222
|
end
|
204
223
|
|
205
224
|
def binary_path
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
225
|
+
if @binary_path.nil?
|
226
|
+
$log.info "Locating application binary..."
|
227
|
+
dirs = $device.ops.dir_glob("#{@app_dir}/", "**")
|
228
|
+
dirs.select! do |f|
|
229
|
+
$device.ops.file_exists? "#{f}/#{binary_name}"
|
230
|
+
end
|
231
|
+
|
232
|
+
@binary_path = "#{dirs.first}/#{binary_name}"
|
233
|
+
else
|
234
|
+
@binary_path
|
210
235
|
end
|
211
236
|
|
212
|
-
"#{dirs.first}/#{binary_name}"
|
213
237
|
end
|
214
238
|
|
215
239
|
def binary_name
|
@@ -270,6 +294,16 @@ module Idb
|
|
270
294
|
end
|
271
295
|
end
|
272
296
|
|
297
|
+
|
298
|
+
def entitlements
|
299
|
+
if $device.ios_version >= 10
|
300
|
+
@services_map.entitlements_by_binary(binary_path)
|
301
|
+
elsif $device.ios_version >= 8
|
302
|
+
@services_map.entitlements_by_bundle_id(bundle_id)
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
306
|
+
|
273
307
|
private
|
274
308
|
|
275
309
|
def parse_info_plist
|
@@ -307,5 +341,6 @@ module Idb
|
|
307
341
|
$log.info "Info.plist found at #{plist_file}"
|
308
342
|
plist_file
|
309
343
|
end
|
344
|
+
|
310
345
|
end
|
311
346
|
end
|
data/lib/lib/device.rb
CHANGED
@@ -65,18 +65,32 @@ module Idb
|
|
65
65
|
|
66
66
|
@apps_dir_ios_9 = '/private/var/containers/Bundle/Application'
|
67
67
|
@data_dir_ios_9 = @data_dir_ios_8
|
68
|
+
@application_state_ios_10 = "/User/Library/FrontBoard/applicationState.db"
|
68
69
|
|
69
|
-
|
70
|
+
$log.info "Checking iOS version"
|
71
|
+
|
72
|
+
@ops.execute"touch /tmp/daniel"
|
73
|
+
|
74
|
+
if @ops.file_exists? @application_state_ios_10
|
75
|
+
$log.info "iOS Version: 10 or newer"
|
76
|
+
@ios_version = 10
|
77
|
+
@apps_dir = @apps_dir_ios_9
|
78
|
+
@data_dir = @data_dir_ios_9
|
79
|
+
|
80
|
+
elsif @ops.directory? @apps_dir_ios_9
|
81
|
+
$log.info "iOS Version: 9"
|
70
82
|
@ios_version = 9
|
71
83
|
@apps_dir = @apps_dir_ios_9
|
72
84
|
@data_dir = @data_dir_ios_9
|
73
85
|
|
74
86
|
elsif @ops.directory? @apps_dir_ios_8
|
87
|
+
$log.info "iOS Version: 8"
|
75
88
|
@ios_version = 8
|
76
89
|
@apps_dir = @apps_dir_ios_8
|
77
90
|
@data_dir = @data_dir_ios_8
|
78
91
|
|
79
92
|
elsif @ops.directory? @apps_dir_ios_pre8
|
93
|
+
$log.info "iOS Version: 7 or earlier"
|
80
94
|
@ios_version = 7 # 7 or earlier
|
81
95
|
@apps_dir = @apps_dir_ios_pre8
|
82
96
|
@data_dir = @apps_dir_ios_pre8
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'plist4r'
|
2
|
+
require 'sqlite3'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
class IOS10ApplicationStateDbWrapper
|
6
|
+
def initialize
|
7
|
+
@db_file = "/User/Library/FrontBoard/applicationState.db"
|
8
|
+
|
9
|
+
@cache_path = "#{$tmp_path}/device/applicationState.db"
|
10
|
+
|
11
|
+
@ldid_binary = "/usr/bin/ldid"
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# download latest db file
|
16
|
+
FileUtils.mkpath "#{$tmp_path}/device" unless File.directory? "#{$tmp_path}/device"
|
17
|
+
$device.ops.download @db_file, @cache_path
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def entitlements_by_binary(binary_path)
|
23
|
+
unless $device.ops.file_exists?(@ldid_binary)
|
24
|
+
$log.error "Cannot find ldid binary at #{@ldid_binary}"
|
25
|
+
return ""
|
26
|
+
end
|
27
|
+
|
28
|
+
plist = $device.ops.execute("#{@ldid_binary} -e #{binary_path}")
|
29
|
+
entitlements = Plist4r.new({:from_string => plist})
|
30
|
+
puts entitlements
|
31
|
+
entitlements
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def data_path_by_bundle_id(bundle_id)
|
36
|
+
|
37
|
+
#puts @cache_path
|
38
|
+
db = SQLite3::Database.open @cache_path
|
39
|
+
#puts db.inspect
|
40
|
+
|
41
|
+
#puts bundle_id
|
42
|
+
plist = ""
|
43
|
+
|
44
|
+
# I fail to get prepared statements to work with SQLite... So using strig concatenation instead. here be dragons
|
45
|
+
stmnt = db.prepare "SELECT kvs.value FROM application_identifier_tab left join kvs on application_identifier_tab.id = kvs.application_identifier where kvs.key = 2 and application_identifier_tab.application_identifier='#{bundle_id}'"
|
46
|
+
# stmnt.bind_params(bundle_id)
|
47
|
+
rs = stmnt.execute
|
48
|
+
#
|
49
|
+
#binding.pry
|
50
|
+
#puts rs.inspect
|
51
|
+
row = rs.next
|
52
|
+
if row.nil?
|
53
|
+
return nil
|
54
|
+
end
|
55
|
+
#puts row.inspect
|
56
|
+
plist = row[0]
|
57
|
+
|
58
|
+
#puts plist
|
59
|
+
|
60
|
+
outer_plist = Plist4r.new({:from_string => plist})
|
61
|
+
h = outer_plist.to_hash
|
62
|
+
if h.key? "sandboxPath"
|
63
|
+
return h["sandboxPath"]
|
64
|
+
end
|
65
|
+
#puts outer_plist.inspect
|
66
|
+
plist = outer_plist.to_hash["String"]
|
67
|
+
inner_plist = Plist4r::Plist.new({:from_string => plist})
|
68
|
+
return inner_plist.to_hash["$objects"][4]
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def keychain_access_groups_by_binary binary_path
|
73
|
+
unless $device.ops.file_exists?(@ldid_binary)
|
74
|
+
$log.error "Cannot find ldid binary at #{@ldid_binary}"
|
75
|
+
return ""
|
76
|
+
end
|
77
|
+
|
78
|
+
plist = $device.ops.execute("#{@ldid_binary} -e #{binary_path}")
|
79
|
+
entitlements = Plist4r.new({:from_string => plist})
|
80
|
+
puts entitlements["keychain-access-groups"]
|
81
|
+
return entitlements["keychain-access-groups"]
|
82
|
+
end
|
83
|
+
end
|
data/lib/lib/ssh_operations.rb
CHANGED
@@ -22,6 +22,13 @@ module Idb
|
|
22
22
|
$log.info 'Establishing SFTP Session...'
|
23
23
|
@sftp = Net::SFTP::Session.new @ssh
|
24
24
|
@sftp.loop { @sftp.opening? }
|
25
|
+
unless @sftp.open?
|
26
|
+
$log.error 'SFTP connection could not be established.'
|
27
|
+
error = Qt::MessageBox.new
|
28
|
+
error.setInformativeText("SFTP connection could not be established. Ensure SFTP is available on the iOS device, e.g., by installing the OpenSSH package.")
|
29
|
+
error.setIcon(Qt::MessageBox::Critical)
|
30
|
+
error.exec
|
31
|
+
end
|
25
32
|
rescue StandardError => ex
|
26
33
|
error = Qt::MessageBox.new
|
27
34
|
error.setInformativeText("SSH connection could not be established: #{ex.message}")
|
@@ -86,7 +93,8 @@ module Idb
|
|
86
93
|
def file_exists?(path)
|
87
94
|
@sftp.stat!(path)
|
88
95
|
return true
|
89
|
-
rescue
|
96
|
+
rescue Exception => e
|
97
|
+
$log.debug("File not found: #{e.message}")
|
90
98
|
return false
|
91
99
|
end
|
92
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel A. Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -344,6 +344,7 @@ files:
|
|
344
344
|
- lib/lib/device.rb
|
345
345
|
- lib/lib/device_ca_interface.rb
|
346
346
|
- lib/lib/host_file_wrapper.rb
|
347
|
+
- lib/lib/ios10_application_state_db_wrapper.rb
|
347
348
|
- lib/lib/ios8_last_launch_services_map_wrapper.rb
|
348
349
|
- lib/lib/keychain_wrapper.rb
|
349
350
|
- lib/lib/local_operations.rb
|