idb 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -0
  3. data/Gemfile.lock +5 -0
  4. data/idb.gemspec +1 -0
  5. data/lib/gui/app_binary_tab_widget.rb +7 -14
  6. data/lib/gui/app_details_group_box.rb +63 -88
  7. data/lib/gui/app_list_dialog.rb +29 -35
  8. data/lib/gui/app_list_widget_item.rb +1 -5
  9. data/lib/gui/app_tab_widget.rb +17 -22
  10. data/lib/gui/binary_strings_widget.rb +7 -15
  11. data/lib/gui/ca_manager_dialog.rb +32 -54
  12. data/lib/gui/cache_db_widget.rb +21 -26
  13. data/lib/gui/certificate_item.rb +2 -2
  14. data/lib/gui/default_protection_class_group_widget.rb +7 -12
  15. data/lib/gui/device_info_group_box.rb +26 -23
  16. data/lib/gui/main_tab_widget.rb +2 -21
  17. data/lib/gui/shared_libraries_widget.rb +1 -1
  18. data/lib/gui/sqlite_widget.rb +1 -3
  19. data/lib/gui/weak_class_dump_widget.rb +1 -1
  20. data/lib/idb.rb +3 -3
  21. data/lib/idb/version.rb +1 -1
  22. data/lib/lib/abstract_device.rb +7 -11
  23. data/lib/lib/app.rb +49 -59
  24. data/lib/lib/app_binary.rb +18 -29
  25. data/lib/lib/ca_interface.rb +46 -59
  26. data/lib/lib/device.rb +68 -155
  27. data/lib/lib/device_ca_interface.rb +7 -13
  28. data/lib/lib/host_file_wrapper.rb +6 -8
  29. data/lib/lib/ios8_last_launch_services_map_wrapper.rb +11 -18
  30. data/lib/lib/local_operations.rb +24 -32
  31. data/lib/lib/otool_wrapper.rb +30 -33
  32. data/lib/lib/rsync_git_manager.rb +26 -22
  33. data/lib/lib/screen_shot_util.rb +20 -28
  34. data/lib/lib/settings.rb +14 -17
  35. data/lib/lib/simulator.rb +11 -16
  36. data/lib/lib/simulator_ca_interface.rb +1 -3
  37. data/lib/lib/ssh_operations.rb +49 -65
  38. data/lib/lib/ssh_port_forwarder.rb +9 -13
  39. data/lib/lib/tools.rb +3 -3
  40. data/lib/lib/url_scheme_fuzzer.rb +41 -49
  41. data/lib/lib/usb_muxd_wrapper.rb +6 -8
  42. data/lib/lib/weak_class_dump_wrapper.rb +15 -16
  43. metadata +19 -9
  44. data/lib/gui/console_widget.rb +0 -163
  45. data/lib/gui/cycript_console_widget.rb +0 -68
  46. data/lib/gui/cycript_thread.rb +0 -81
  47. data/lib/lib/console_launcher.rb +0 -24
  48. data/lib/lib/i_device_diagnostics_wrapper.rb +0 -90
  49. data/lib/lib/snoop_it_wrapper.rb +0 -80
@@ -3,42 +3,36 @@ require 'digest/sha1'
3
3
  require 'sqlite3'
4
4
  require "webrick"
5
5
 
6
-
7
-
8
6
  module Idb
9
7
  class CAInterface
10
-
11
8
  # performs uninstall based on sha1 hash provided in certfile
12
- def remove_cert cert
9
+ def remove_cert(cert)
13
10
  der = cert.to_der
14
11
 
15
- query = %Q|DELETE FROM "tsettings" WHERE sha1 = #{blobify(sha1_from_der der)};|
12
+ query = %(DELETE FROM "tsettings" WHERE sha1 = #{blobify(sha1_from_der(der))};)
16
13
  begin
17
14
  db = SQLite3::Database.new(@db_path)
18
15
  db.execute(query)
19
16
  db.close
20
- rescue Exception => e
17
+ rescue StandardError => e
21
18
  raise "[*] Error writing to SQLite database at #{@db_path}: #{e.message}"
22
- return
23
19
  end
24
- puts "[*] Operation complete"
25
20
  end
26
21
 
27
- def server_cert cert_file
22
+ def server_cert(cert_file)
28
23
  FileUtils.mkpath "#{$tmp_path}/CAs"
29
24
  cert_file_cache = "#{$tmp_path}/CAs/CA.pem"
30
25
 
31
26
  FileUtils.copy cert_file, cert_file_cache
32
- #copy cert file to tmp
33
- @server_thread = Thread.new {
34
- @server = WEBrick::HTTPServer.new(:Port => $settings['idb_utility_port'])
27
+ # copy cert file to tmp
28
+ @server_thread = Thread.new do
29
+ @server = WEBrick::HTTPServer.new(Port: $settings['idb_utility_port'])
35
30
  @server.mount "/", WEBrick::HTTPServlet::FileHandler, "#{$tmp_path}/CAs/"
36
31
  @server.start
37
- }
32
+ end
38
33
 
39
34
  sleep 0.5
40
35
  $device.open_url "http://localhost:#{$settings['idb_utility_port']}/CA.pem"
41
-
42
36
  end
43
37
 
44
38
  def stop_cert_server
@@ -46,53 +40,58 @@ module Idb
46
40
  @server_thread.terminate unless @server_thread.nil?
47
41
  end
48
42
 
49
-
50
- def add_cert cert_file
43
+ def read_cert(cert_file)
51
44
  cert_file = File.expand_path(cert_file)
52
- if not File.exist? cert_file
53
- raise "File #{cert_file} does not exist."
54
- end
45
+ raise "File #{cert_file} does not exist." unless File.exist? cert_file
55
46
 
56
- cert = parse_certificate cert_file
47
+ parse_certificate cert_file
48
+ end
49
+
50
+ def add_cert(cert_file)
51
+ cert = read_cert cert_file
57
52
 
58
53
  # create plist file
59
- #TODO might want to use the plist library instead
60
- tset = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<array/>\n</plist>\n"
61
- data = cert[:cert].to_der
54
+ # TODO might want to use the plist library instead
55
+ tset = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
56
+ "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\"" \
57
+ " \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" \
58
+ "<plist version=\"1.0\">\n<array/>\n</plist>\n"
59
+ data = cert[:cert].to_der
60
+
61
+ insert_cert_into_trust_store cert[:fprint], cert[:subject], tset, data
62
+ end
62
63
 
64
+ def insert_cert_into_trust_store(fprint, subject, tset, data)
63
65
  puts "[*] Inserting certificate into trust store..."
64
66
 
65
- query = %Q|INSERT INTO "tsettings" VALUES(#{blobify(cert[:fprint])},#{blobify(cert[:subject])},#{blobify(tset)},#{blobify(data)});|
67
+ query = %|INSERT INTO "tsettings" VALUES(#{blobify(fprint)},
68
+ #{blobify(subject)},#{blobify(tset)},#{blobify(data)});|
66
69
  begin
67
70
  db = SQLite3::Database.new(@db_path)
68
71
  db.execute(query)
69
72
  db.close
70
- rescue Exception => e
71
- if e.message.include? "column sha1 is not unique"
72
- raise "The same certificate is installed already."
73
- else
74
- raise "Error writing to SQLite database at #{@db_path}: #{e.message}"
75
- end
76
- return
73
+ rescue StandardError => e
74
+ error = "column sha1 is not unique"
75
+ raise "The certificate is installed already." if e.message.include? error
76
+ raise "Error writing to SQLite database at #{@db_path}: #{e.message}"
77
77
  end
78
78
  end
79
79
 
80
- def get_certs
81
- query = %Q|SELECT * FROM "tsettings";|
80
+ def certs
81
+ query = %(SELECT * FROM "tsettings";)
82
82
  begin
83
83
  db = SQLite3::Database.new(@db_path)
84
84
  result = db.execute(query)
85
85
  db.close
86
- rescue Exception => e
86
+ rescue StandardError => e
87
87
  raise "Error reading from SQLite database at #{@db_path}: #{e.message}"
88
88
  end
89
- result.map { |x|
89
+ result.map do |x|
90
90
  OpenSSL::X509::Certificate.new(x[3])
91
- }
91
+ end
92
92
  end
93
93
 
94
-
95
- def sha1_from_der der
94
+ def sha1_from_der(der)
96
95
  Digest::SHA1.digest(der)
97
96
  end
98
97
 
@@ -106,7 +105,7 @@ module Idb
106
105
  "X'#{string_to_hex bin}'"
107
106
  end
108
107
 
109
- def parse_certificate cert_file
108
+ def parse_certificate(cert_file)
110
109
  puts "[*] Reading and converting certificate..."
111
110
  # Open and convert certificate
112
111
  cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
@@ -114,38 +113,26 @@ module Idb
114
113
  subj = cert.subject.to_der
115
114
  puts subj.inspect
116
115
  # Thanks Andy Schmitz
117
- #toSkip = (subj[1].ord & 0x80) == 0 ? 2 : ((subj[2].ord & 0x7f) + 2)
118
- toSkip = 3
119
- subj = subj[toSkip..-1]
120
- # subj = subj.gsub("PortSwigger","PORTSWIGGER")
121
- #subj = "1\v0\t\x06\x03U\x04\x06\x13\x02US1\v0\t\x06\x03U\x04\b\x13\x02IL1\x100\x0E\x06\x03U\x04\a\x13\aCHICAGO1\x1A0\x18\x06\x03U\x04\n\x13\x11MATASANO SECURITY1\e0\x19\x06\x03U\x04\v\x13\x12PENTESTING MADNESS1\x1F0\x1D\x06\x03U\x04\x03\x13\x16CA.DANIEL.MATASANO.COM"
116
+ # to_skip = (subj[1].ord & 0x80) == 0 ? 2 : ((subj[2].ord & 0x7f) + 2)
117
+ to_skip = 3
118
+ subj = subj[to_skip..-1]
122
119
  puts subj.inspect
123
120
 
124
- #subj = "1\x140\x12\x06\x03U\x04\x06\x13\vPORTSWIGGER1\x140\x12\x06\x03U\x04\b\x13\vPORTSWIGGER1\x140\x12\x06\x03U\x04\a\x13\vPORTSWIGGER1\x140\x12\x06\x03U\x04\n\x13\vPORTSWIGGER1\x170\x15\x06\x03U\x04\v\x13\x0EPORTSWIGGER CA1\x170\x15\x06\x03U\x04\x03\x13\x0EPORTSWIGGER CA"
125
-
126
- return {:cert => cert, :fprint => fprint, :subject => subj}
121
+ { cert: cert, fprint: fprint, subject: subj }
127
122
  end
128
123
 
129
-
130
- def validate? cert_file
131
- if not File.exist? cert_file
124
+ def validate?(cert_file)
125
+ unless File.exist? cert_file
132
126
  puts "File #{cert_file} does not exist."
133
127
  return false
134
128
  end
135
129
 
136
- if not File.file? cert_file
130
+ unless File.file? cert_file
137
131
  puts "#{cert_file} is not a file."
138
132
  return false
139
133
  end
140
134
 
141
- return true
135
+ true
142
136
  end
143
137
  end
144
-
145
- class CAServlet < WEBrick::HTTPServlet::AbstractServlet
146
- def do_GET (request, response)
147
-
148
- end
149
-
150
- end
151
138
  end
@@ -9,10 +9,9 @@ require 'json'
9
9
  module Idb
10
10
  class Device < AbstractDevice
11
11
  attr_accessor :usb_ssh_port, :mode, :tool_port, :ios_version
12
+ attr_reader :data_dir
12
13
 
13
- def initialize username, password, hostname, port
14
-
15
-
14
+ def initialize(username, password, hostname, port)
16
15
  @username = username
17
16
  @password = password
18
17
  @hostname = hostname
@@ -20,13 +19,15 @@ module Idb
20
19
 
21
20
  @app = nil
22
21
 
23
- @device_app_paths = Hash.new
24
- @device_app_paths[:cycript] = [ "/usr/bin/cycript" ]
25
- @device_app_paths[:rsync] = [ "/usr/bin/rsync" ]
22
+ @device_app_paths = {}
23
+ @device_app_paths[:cycript] = ["/usr/bin/cycript"]
24
+ @device_app_paths[:rsync] = ["/usr/bin/rsync"]
26
25
  @device_app_paths[:open] = ["/usr/bin/open"]
27
- @device_app_paths[:openurl] = ["/usr/bin/uiopen", "/usr/bin/openurl", "/usr/bin/openURL"]
28
- @device_app_paths[:aptget] = ["/usr/bin/apt-get", "/usr/bin/aptitude"]
29
- @device_app_paths[:keychaineditor] = [ "/var/root/keychaineditor"]
26
+ @device_app_paths[:openurl] = ["/usr/bin/uiopen",
27
+ "/usr/bin/openurl",
28
+ "/usr/bin/openURL"]
29
+ @device_app_paths[:aptget] = ["/usr/bin/apt-get", "/usr/bin/aptitude"]
30
+ @device_app_paths[:keychaineditor] = ["/var/root/keychaineditor"]
30
31
  @device_app_paths[:pcviewer] = ["/var/root/protectionclassviewer"]
31
32
  @device_app_paths[:pbwatcher] = ["/var/root/pbwatcher"]
32
33
  @device_app_paths[:dumpdecrypted_armv7] = ["/usr/lib/dumpdecrypted_armv7.dylib"]
@@ -45,10 +46,7 @@ module Idb
45
46
 
46
47
  @usbmuxd.proxy proxy_port, $settings['ssh_port']
47
48
  sleep 1
48
-
49
-
50
-
51
-
49
+
52
50
  @ops = SSHOperations.new username, password, 'localhost', proxy_port
53
51
 
54
52
  @usb_ssh_port = $settings['manual_ssh_port']
@@ -87,6 +85,7 @@ module Idb
87
85
  $log.error "Unsupported iOS Version."
88
86
  raise
89
87
  end
88
+ $log.info "iOS Version: #{@ios_version} with apps dir: #{@apps_dir} and data dir: #{@data_dir}"
90
89
 
91
90
  start_port_forwarding
92
91
  end
@@ -95,7 +94,6 @@ module Idb
95
94
  @ops.ssh
96
95
  end
97
96
 
98
-
99
97
  def disconnect
100
98
  @ops.disconnect
101
99
  end
@@ -109,7 +107,8 @@ module Idb
109
107
  end
110
108
 
111
109
  def start_port_forwarding
112
- @port_forward_pid = Process.spawn("#{RbConfig.ruby} #{File.dirname(File.expand_path(__FILE__))}/../helper/ssh_port_forwarder.rb" )
110
+ command = "#{RbConfig.ruby} #{Idb.root}/lib/helper/ssh_port_forwarder.rb"
111
+ @port_forward_pid = Process.spawn(command)
113
112
  end
114
113
 
115
114
  def restart_port_forwarding
@@ -118,7 +117,7 @@ module Idb
118
117
  start_port_forwarding
119
118
  end
120
119
 
121
- def protection_class file
120
+ def protection_class(file)
122
121
  @ops.execute "#{pcviewer_path} '#{file}'"
123
122
  end
124
123
 
@@ -126,11 +125,11 @@ module Idb
126
125
  false
127
126
  end
128
127
 
129
- def app_launch app
128
+ def app_launch(app)
130
129
  @ops.launch_app(open_path, app.bundle_id)
131
130
  end
132
131
 
133
- def is_installed? tool
132
+ def is_installed?(tool)
134
133
  $log.info "Checking if #{tool} is installed..."
135
134
  if path_for(tool).nil?
136
135
  $log.warn "#{tool} not found."
@@ -141,16 +140,13 @@ module Idb
141
140
  end
142
141
  end
143
142
 
144
- def path_for tool
145
- @device_app_paths[tool].each { |x|
146
- if @ops.file_exists? x
147
- return x
148
- end
149
- }
150
- return nil
143
+ def path_for(tool)
144
+ @device_app_paths[tool].each do |device_app_path|
145
+ return device_app_path if @ops.file_exists? device_app_path
146
+ end
147
+ nil
151
148
  end
152
149
 
153
-
154
150
  def install_dumpdecrypted
155
151
  upload_dumpdecrypted
156
152
  # Change permissions as this needs to be run as the mobile user
@@ -158,142 +154,70 @@ module Idb
158
154
  @ops.chmod dumpdecrypted_path_armv6, 0755
159
155
  end
160
156
 
161
- def install_dumpdecrypted_old
162
- unless File.exist? "utils/dumpdecrypted/dumpdecrypted.dylib"
163
- puts "[**] Warning: dumpdecrypted not compiled."
164
- puts "[**] Due to licensing issue we cannot ship the compiled library with this tool."
165
- puts "[**] Attempting compilation (requires a valid iOS SDK installation)..."
166
- compile_dumpdecrypted
167
-
168
- if File.exist? "utils/dumpdecrypted/dumpdecrypted.dylib"
169
- puts "[**] Compilation successful."
170
- upload_dumpdecryted
171
- else
172
- puts "[**] Error: Compilation failed."
173
- puts "[**] Change into the utils/dumpdecrypted directory, adjust the makefile, and compile."
174
- end
175
- else
176
- upload_dumpdecryted
177
- end
178
- end
179
-
180
-
181
- def compile_dumpdecrypted
182
- base_dir = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer'
183
- unless Dir.exist? base_dir
184
- puts "[**] Error, iOS Platform tools not found at #{base_dir}"
185
- return
186
- end
187
-
188
-
189
- bin_dir = "#{base_dir}/usr/bin"
190
- sdk_dir = Dir.glob("#{base_dir}/SDKs/iPhoneOS*.sdk/").first
191
- puts "[*] Found SDK dir: #{sdk_dir}"
192
-
193
- library_name = "dumpdecrypted.dylib"
194
- gcc = "#{bin_dir}/gcc"
195
-
196
- unless File.exist? gcc
197
- puts "[**] Error: gcc not found at #{gcc}"
198
- puts "[**] Ensure that the Command Line Utilities are installed in XCode 4."
199
- puts "[**] XCode 5 does not ship with llvm-gcc anymore."
200
- return
201
- end
202
-
203
-
204
-
205
- params = ["-arch armv7", # adjust if necessary
206
- "-wimplicit",
207
- "-isysroot #{sdk_dir}",
208
- "-F#{sdk_dir}System/Library/Frameworks",
209
- "-F#{sdk_dir}System/Library/PrivateFrameworks",
210
- "-dynamiclib",
211
- "-o #{library_name}"].join(' ')
212
-
213
- compile_cmd = "#{gcc} #{params} dumpdecrypted.c"
214
- puts "Running #{compile_cmd}"
215
-
216
- Dir.chdir("utils/dumpdecrypted") do
217
- `#{compile_cmd}`
218
- end
219
- end
220
-
221
-
222
157
  def upload_dumpdecrypted
223
158
  $log.info "Uploading dumpdecrypted library..."
224
- @ops.upload("#{Idb.root}/lib/utils/dumpdecrypted/dumpdecrypted_armv6.dylib", @device_app_paths[:dumpdecrypted_armv6].first)
225
- @ops.upload("#{Idb.root}/lib/utils/dumpdecrypted/dumpdecrypted_armv7.dylib", @device_app_paths[:dumpdecrypted_armv7].first)
159
+ @ops.upload("#{Idb.root}/lib/utils/dumpdecrypted/dumpdecrypted_armv6.dylib",
160
+ @device_app_paths[:dumpdecrypted_armv6].first)
161
+ @ops.upload("#{Idb.root}/lib/utils/dumpdecrypted/dumpdecrypted_armv7.dylib",
162
+ @device_app_paths[:dumpdecrypted_armv7].first)
226
163
  $log.info "'dumpdecrypted' installed successfully."
227
164
  end
228
165
 
229
166
  def install_keychain_editor
230
- if File.exist? "#{File.dirname(File.expand_path(__FILE__))}/../utils/keychain_editor/keychaineditor"
167
+ keychaineditor_path = "#{Idb.root}/lib/utils/keychain_editor/keychaineditor"
168
+ if File.exist? keychaineditor_path
231
169
  upload_keychain_editor
232
170
  else
233
- $log.error "keychain_editor not found at '#{File.dirname(File.expand_path(__FILE__))}/../utils/keychain_editor/keychaineditor'."
171
+ $log.error "keychain_editor not found at '#{keychaineditor_path}'."
234
172
  false
235
173
  end
236
174
  end
175
+
237
176
  def install_pcviewer
238
- if File.exist? "#{File.dirname(File.expand_path(__FILE__))}/../utils/pcviewer/protectionclassviewer"
177
+ pcviewer_path = "#{Idb.root}/lib/utils/pcviewer/protectionclassviewer"
178
+ if File.exist? pcviewer_path
239
179
  upload_pcviewer
240
180
  else
241
- $log.error "protectionclassviewer not found at '#{File.dirname(File.expand_path(__FILE__))}/../utils/pcviewer/protectionclassviewer'."
181
+ $log.error "protectionclassviewer not found at '#{pcviewer_path}'."
242
182
  false
243
183
  end
244
184
  end
245
185
 
246
-
247
186
  def install_pbwatcher
248
- if File.exist? "#{File.dirname(File.expand_path(__FILE__))}/../utils/pbwatcher/pbwatcher"
187
+ pbwatcher_path = "#{Idb.root}/lib/utils/pbwatcher/pbwatcher"
188
+ if File.exist? pbwatcher_path
249
189
  upload_pbwatcher
250
190
  else
251
- $log.error "pbwatcher not found at '#{File.dirname(File.expand_path(__FILE__))}/../utils/pbwatcher/pbwatcher'."
191
+ $log.error "pbwatcher not found at '#{pbwatcher_path}'."
252
192
  false
253
193
  end
254
194
  end
255
195
 
256
196
  def upload_pcviewer
257
- begin
258
- $log.info "Uploading pcviewer..."
259
- @ops.upload "#{File.dirname(File.expand_path(__FILE__))}/../utils/pcviewer/protectionclassviewer", "/var/root/protectionclassviewer"
260
- @ops.chmod "/var/root/protectionclassviewer", 0744
261
- $log.info "'pcviewer' installed successfully."
262
- # true
263
- # rescue
264
- $log.error "Exception encountered when uploading pcviewer"
265
- # false
266
- end
197
+ local_pcviewer_path = "#{Idb.root}/lib/utils/pcviewer/protectionclassviewer"
198
+ $log.info "Uploading pcviewer..."
199
+ @ops.upload local_pcviewer_path, "/var/root/protectionclassviewer"
200
+ @ops.chmod "/var/root/protectionclassviewer", 0744
201
+ $log.info "'pcviewer' installed successfully."
267
202
  end
268
203
 
269
204
  def upload_keychain_editor
270
- begin
271
- $log.info "Uploading keychain_editor..."
272
- @ops.upload "#{File.dirname(File.expand_path(__FILE__))}/../utils/keychain_editor/keychaineditor", "/var/root/keychaineditor"
273
- @ops.chmod "/var/root/keychaineditor", 0744
274
- $log.info "'keychain_editor' installed successfully."
275
- # true
276
- # rescue
277
- $log.error "Exception encountered when uploading keychain_editor"
278
- # false
279
- end
205
+ local_keychaineditor_path = "#{Idb.root}/lib/utils/keychain_editor/keychaineditor"
206
+ $log.info "Uploading keychain_editor..."
207
+ @ops.upload local_keychaineditor_path, "/var/root/keychaineditor"
208
+ @ops.chmod "/var/root/keychaineditor", 0744
209
+ $log.info "'keychain_editor' installed successfully."
280
210
  end
211
+
281
212
  def upload_pbwatcher
282
- # TODO What's happening here?
283
- begin
284
- $log.info "Uploading pbwatcher..."
285
- @ops.upload "#{File.dirname(File.expand_path(__FILE__))}/../utils/pbwatcher/pbwatcher", "/var/root/pbwatcher"
286
- @ops.chmod "/var/root/pbwatcher", 0744
287
- $log.info "'pbwatcher' installed successfully."
288
- # true
289
- # rescue
290
- $log.error "Exception encountered when uploading pbwatcher"
291
- # false
292
- end
213
+ local_pbwatcher_path = "#{Idb.root}/lib/utils/pbwatcher/pbwatcher"
214
+ $log.info "Uploading pbwatcher..."
215
+ @ops.upload local_pbwatcher_path, "/var/root/pbwatcher"
216
+ @ops.chmod "/var/root/pbwatcher", 0744
217
+ $log.info "'pbwatcher' installed successfully."
293
218
  end
294
219
 
295
-
296
- def install_from_cydia package
220
+ def install_from_cydia(package)
297
221
  if apt_get_installed?
298
222
  $log.info "Updating package repo..."
299
223
  @ops.execute("#{apt_get_path} -y update")
@@ -325,13 +249,11 @@ module Idb
325
249
  Process.kill("INT", @port_forward_pid)
326
250
  $log.info "Stopping any SSH via USB forwarding"
327
251
 
328
- if $settings['device_connection_mode'] != "ssh"
329
- @usbmuxd.stop_all
330
- end
252
+ @usbmuxd.stop_all if $settings['device_connection_mode'] != "ssh"
331
253
  end
332
254
 
333
- def open_url url
334
- command = "#{openurl_path} \"#{url.gsub('&','\&')}\""
255
+ def open_url(url)
256
+ command = "#{openurl_path} \"#{url.gsub('&', '\&')}\""
335
257
  $log.info "Executing: #{command}"
336
258
  @ops.execute command
337
259
  end
@@ -340,29 +262,27 @@ module Idb
340
262
  DeviceCAInterface.new self
341
263
  end
342
264
 
343
- def kill_by_name process_name
265
+ def kill_by_name(process_name)
344
266
  @ops.execute "killall -9 #{process_name}"
345
267
  end
346
268
 
347
269
  def device_id
348
-
349
270
  $log.error "Not implemented"
350
271
  nil
351
272
  end
352
273
 
353
274
  def configured?
354
- apt_get_installed? and
355
- open_installed? and
356
- openurl_installed? and
357
- dumpdecrypted_installed? and
358
- pbwatcher_installed? and
359
- pcviewer_installed? and
360
- keychain_editor_installed? and
361
- rsync_installed? and
362
- cycript_installed?
275
+ apt_get_installed? &&
276
+ open_installed? &&
277
+ openurl_installed? &&
278
+ dumpdecrypted_installed? &&
279
+ pbwatcher_installed? &&
280
+ pcviewer_installed? &&
281
+ keychain_editor_installed? &&
282
+ rsync_installed? &&
283
+ cycript_installed?
363
284
  end
364
285
 
365
-
366
286
  def cycript_installed?
367
287
  is_installed? :cycript
368
288
  end
@@ -380,10 +300,9 @@ module Idb
380
300
  end
381
301
 
382
302
  def dumpdecrypted_installed?
383
- is_installed? :dumpdecrypted_armv6 and is_installed? :dumpdecrypted_armv7
303
+ is_installed?(:dumpdecrypted_armv6) && is_installed?(:dumpdecrypted_armv7)
384
304
  end
385
305
 
386
-
387
306
  def rsync_installed?
388
307
  is_installed? :rsync
389
308
  end
@@ -405,15 +324,13 @@ module Idb
405
324
  end
406
325
 
407
326
  def pcviewer_path
408
- path_for :pcviewer
327
+ path_for :pcviewer
409
328
  end
410
329
 
411
-
412
330
  def pbwatcher_path
413
331
  path_for :pbwatcher
414
332
  end
415
333
 
416
-
417
334
  def dumpdecrypted_path
418
335
  path_for :dumpdecrypted_armv7
419
336
  end
@@ -426,17 +343,14 @@ module Idb
426
343
  path_for :rsync
427
344
  end
428
345
 
429
-
430
346
  def open_path
431
347
  path_for :open
432
348
  end
433
349
 
434
-
435
350
  def openurl_path
436
351
  path_for :openurl
437
352
  end
438
353
 
439
-
440
354
  def apt_get_path
441
355
  path_for :aptget
442
356
  end
@@ -444,6 +358,5 @@ module Idb
444
358
  def cycript_path
445
359
  path_for :cycript
446
360
  end
447
-
448
361
  end
449
362
  end