idevice 1.1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +18 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +4 -0
  4. data/NOTICE +202 -0
  5. data/README.md +74 -0
  6. data/Rakefile +37 -0
  7. data/examples/idevimgmount +58 -0
  8. data/examples/idumplockdownvalues +64 -0
  9. data/examples/ifetchcrashreports +54 -0
  10. data/examples/ilistapps +38 -0
  11. data/examples/ilistudids +26 -0
  12. data/examples/ilog +35 -0
  13. data/examples/installipa +51 -0
  14. data/examples/iremoveapp +42 -0
  15. data/examples/irestart +26 -0
  16. data/examples/iscreenshotr +39 -0
  17. data/idevice.gemspec +33 -0
  18. data/lib/idevice.rb +69 -0
  19. data/lib/idevice/afc.rb +518 -0
  20. data/lib/idevice/c.rb +129 -0
  21. data/lib/idevice/diagnostics_relay.rb +185 -0
  22. data/lib/idevice/file_relay.rb +83 -0
  23. data/lib/idevice/heartbeat.rb +99 -0
  24. data/lib/idevice/house_arrest.rb +138 -0
  25. data/lib/idevice/idevice.rb +208 -0
  26. data/lib/idevice/image_mounter.rb +117 -0
  27. data/lib/idevice/installation_proxy.rb +193 -0
  28. data/lib/idevice/lockdown.rb +350 -0
  29. data/lib/idevice/misagent.rb +112 -0
  30. data/lib/idevice/mobilebackup.rb +183 -0
  31. data/lib/idevice/mobilebackup2.rb +174 -0
  32. data/lib/idevice/mobilesync.rb +306 -0
  33. data/lib/idevice/notification_proxy.rb +168 -0
  34. data/lib/idevice/plist.rb +366 -0
  35. data/lib/idevice/restore.rb +176 -0
  36. data/lib/idevice/sbservices.rb +152 -0
  37. data/lib/idevice/screenshotr.rb +88 -0
  38. data/lib/idevice/version.rb +3 -0
  39. data/lib/idevice/webinspector.rb +96 -0
  40. data/spec/afc_devicespec.rb +409 -0
  41. data/spec/diagnostics_relay_devicespec.rb +125 -0
  42. data/spec/file_relay_devicespec.rb +45 -0
  43. data/spec/heartbeat_devicespec.rb +39 -0
  44. data/spec/idevice_devicespec.rb +93 -0
  45. data/spec/idevice_spec.rb +29 -0
  46. data/spec/image_mounter_devicespec.rb +65 -0
  47. data/spec/installation_proxy_devicespec.rb +54 -0
  48. data/spec/lockdown_devicespec.rb +106 -0
  49. data/spec/misagent_devicespec.rb +43 -0
  50. data/spec/mobilebackup2_devicespec.rb +58 -0
  51. data/spec/mobilebackup_devicespec.rb +41 -0
  52. data/spec/mobilesync_devicespec.rb +62 -0
  53. data/spec/notification_proxy_devicespec.rb +45 -0
  54. data/spec/plist_spec.rb +176 -0
  55. data/spec/restore_devicespec.rb +72 -0
  56. data/spec/samples/plist.bin +0 -0
  57. data/spec/samples/plist.xml +10 -0
  58. data/spec/sbservices_devicespec.rb +64 -0
  59. data/spec/screenshotr_devicespec.rb +39 -0
  60. data/spec/spec_helper.rb +73 -0
  61. data/spec/webinspector_devicespec.rb +36 -0
  62. metadata +233 -0
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ ref
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format doc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in idevice.gemspec
4
+ gemspec
data/NOTICE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Idevice
2
+
3
+ Ruby FFI bindings for libimobiledevice
4
+
5
+ The ruby Idevice library was written primarily as a research tool for
6
+ prototyping iOS tools that use USB as well as a tool to aid in
7
+ reverse-engineering new areas of the iOS USB protocols.
8
+
9
+ ## Versions
10
+
11
+ The ruby idevice package version number corresponds to the libimobiledevice
12
+ version it is built for. Where necessary, an 4th version digit will be
13
+ appended for rubygem-specific fixes and features within a given
14
+ libimobiledevice version cycle.
15
+
16
+ ## Requirements
17
+
18
+ - libplist - https://github.com/libimobiledevice/libplist
19
+ - libimobiledevice - https://github.com/libimobiledevice/libimobiledevice
20
+
21
+ ## Installation
22
+
23
+ Add this line to your application's Gemfile:
24
+
25
+ gem 'idevice'
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install idevice
34
+
35
+ ## Usage
36
+
37
+ See
38
+
39
+ - https://github.com/blueboxsecurity/idevice/tree/master/examples
40
+ - https://github.com/blueboxsecurity/idevice/tree/master/spec
41
+
42
+ ## Author
43
+
44
+ Eric Monti - monti@bluebox.com
45
+
46
+
47
+ ## Issues / Contributing
48
+
49
+ Please submit pull requests using github.
50
+ Report issues at https://github.com/blueboxsecurity/idevice/issues
51
+
52
+
53
+ ## License
54
+
55
+ Copyright (c) 2013 Eric Monti - Bluebox Security
56
+
57
+ Licensed to the Apache Software Foundation (ASF) under one
58
+ or more contributor license agreements. See the NOTICE file
59
+ distributed with this work for additional information
60
+ regarding copyright ownership. The ASF licenses this file
61
+ to you under the Apache License, Version 2.0 (the
62
+ "License"); you may not use this file except in compliance
63
+ with the License. You may obtain a copy of the License at
64
+
65
+ http://www.apache.org/licenses/LICENSE-2.0
66
+
67
+ Unless required by applicable law or agreed to in writing,
68
+ software distributed under the License is distributed on an
69
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
70
+ KIND, either express or implied. See the License for the
71
+ specific language governing permissions and limitations
72
+ under the License.
73
+
74
+
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError => e
6
+ STDERR.puts e.message
7
+ STDERR.puts "Run `gem install bundler` to install Bundler."
8
+ exit e.status_code
9
+ rescue Bundler::BundlerError => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Run `bundle install` to install missing gems"
12
+ exit e.status_code
13
+ end
14
+
15
+ require 'bundler/gem_tasks'
16
+
17
+ require 'rspec/core/rake_task'
18
+ desc "run rspec unit tests"
19
+ RSpec::Core::RakeTask.new
20
+ task :default => :spec
21
+
22
+ namespace :spec do
23
+ desc "run spec and integration tests together"
24
+ RSpec::Core::RakeTask.new(:all) do |t|
25
+ t.pattern = "spec/**/*_{devicespec,spec}.rb"
26
+ end
27
+
28
+ desc "run rspec integration tests (requires idevice connectivity)"
29
+ RSpec::Core::RakeTask.new(:device) do |t|
30
+ t.pattern = "spec/**/*_devicespec.rb"
31
+ end
32
+ end
33
+
34
+ desc "pry console"
35
+ task :console do
36
+ sh "pry -I lib -r ./lib/idevice.rb"
37
+ end
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (c) 2013 Eric Monti - Bluebox Security
4
+ #
5
+ # Licensed to the Apache Software Foundation (ASF) under one
6
+ # or more contributor license agreements. See the NOTICE file
7
+ # distributed with this work for additional information
8
+ # regarding copyright ownership. The ASF licenses this file
9
+ # to you under the Apache License, Version 2.0 (the
10
+ # "License"); you may not use this file except in compliance
11
+ # with the License. You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing,
16
+ # software distributed under the License is distributed on an
17
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ # KIND, either express or implied. See the License for the
19
+ # specific language governing permissions and limitations
20
+ # under the License.
21
+
22
+
23
+ require 'bundler/setup'
24
+ require 'idevice'
25
+ require 'pathname'
26
+
27
+ progname = File.basename($0)
28
+
29
+ dmgpath = ARGV.shift
30
+ sigpath = ARGV.shift
31
+
32
+ if dmgpath.nil? or ARGV.shift
33
+ $stderr.puts "usage: #{progname} /path/to/DeveloperDiskImage.dmg [/path/to/DeveloperDiskImage.dmg.signature]"
34
+ exit(1)
35
+ end
36
+
37
+ dmg = Pathname(dmgpath)
38
+ signature = Pathname(sigpath || "#{dmgpath}.signature")
39
+
40
+ idev = Idevice::Idevice.attach()
41
+
42
+ imgmnt = Idevice::ImageMounterClient.attach(idevice:idev, label:progname)
43
+ begin
44
+ # upload the dmg
45
+ afc = Idevice::AFCClient.attach(idevice:idev, label:progname)
46
+ dstdmg = "PublicStaging/staging.dimage"
47
+ $stderr.puts "[+] Uploading #{dmg} to #{dstdmg}"
48
+ afc.put_path(dmg.to_s, dstdmg)
49
+
50
+ # mount the image as a Developer image using the provided signature
51
+ $stderr.puts "[+] Mounting Developer image"
52
+ imgmnt.mount_image dstdmg.to_s, signature.read(), "Developer"
53
+
54
+ exit(0)
55
+ ensure
56
+ $stderr.puts "[.] hanging up"
57
+ imgmnt.hangup rescue nil
58
+ end
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (c) 2013 Eric Monti - Bluebox Security
4
+ #
5
+ # Licensed to the Apache Software Foundation (ASF) under one
6
+ # or more contributor license agreements. See the NOTICE file
7
+ # distributed with this work for additional information
8
+ # regarding copyright ownership. The ASF licenses this file
9
+ # to you under the Apache License, Version 2.0 (the
10
+ # "License"); you may not use this file except in compliance
11
+ # with the License. You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing,
16
+ # software distributed under the License is distributed on an
17
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ # KIND, either express or implied. See the License for the
19
+ # specific language governing permissions and limitations
20
+ # under the License.
21
+
22
+
23
+ require 'bundler/setup'
24
+ require 'idevice'
25
+ require 'pp'
26
+
27
+ dumpdomains = %W{
28
+ com.apple.disk_usage
29
+ com.apple.disk_usage.factory
30
+ com.apple.mobile.battery
31
+ com.apple.iqagent
32
+ com.apple.purplebuddy
33
+ com.apple.PurpleBuddy
34
+ com.apple.mobile.chaperone
35
+ com.apple.mobile.third_party_termination
36
+ com.apple.mobile.lockdownd
37
+ com.apple.mobile.lockdown_cache
38
+ com.apple.xcode.developerdomain
39
+ com.apple.international
40
+ com.apple.mobile.data_sync
41
+ com.apple.mobile.tethered_sync
42
+ com.apple.mobile.mobile_application_usage
43
+ com.apple.mobile.backup
44
+ com.apple.mobile.nikita
45
+ com.apple.mobile.restriction
46
+ com.apple.mobile.user_preferences
47
+ com.apple.mobile.sync_data_class
48
+ com.apple.mobile.software_behavior
49
+ com.apple.mobile.iTunes.SQLMusicLibraryPostProcessCommands
50
+ com.apple.mobile.iTunes.accessories
51
+ com.apple.mobile.internal
52
+ com.apple.mobile.wireless_lockdown
53
+ com.apple.fairplay
54
+ com.apple.iTunes
55
+ com.apple.mobile.iTunes.store
56
+ com.apple.mobile.iTunes
57
+ }
58
+
59
+ ldc = Idevice::LockdownClient.attach
60
+ dumpdomains.each do |domain|
61
+ puts "[+] Dumping domain: #{domain}"
62
+ pp ldc.get_value(domain, nil)
63
+ puts
64
+ end