idb 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +19 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +65 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +29 -0
  8. data/Rakefile +2 -0
  9. data/bin/idb +5 -0
  10. data/idb.gemspec +41 -0
  11. data/lib/LICENSE +20 -0
  12. data/lib/README.md +54 -0
  13. data/lib/config/.dummy +0 -0
  14. data/lib/config/settings.yml +8 -0
  15. data/lib/gui/app_binary_tab_widget.rb +45 -0
  16. data/lib/gui/app_details_group_box.rb +213 -0
  17. data/lib/gui/app_list_dialog.rb +67 -0
  18. data/lib/gui/app_list_widget_item.rb +9 -0
  19. data/lib/gui/binary_strings_widget.rb +33 -0
  20. data/lib/gui/browse_filesystem_widget.rb +4 -0
  21. data/lib/gui/ca_manager_dialog.rb +137 -0
  22. data/lib/gui/cache_db_widget.rb +61 -0
  23. data/lib/gui/certificate_item.rb +5 -0
  24. data/lib/gui/console_widget.rb +163 -0
  25. data/lib/gui/cycript_console_widget.rb +68 -0
  26. data/lib/gui/cycript_thread.rb +81 -0
  27. data/lib/gui/device_info_group_box.rb +55 -0
  28. data/lib/gui/device_status_dialog.rb +351 -0
  29. data/lib/gui/file_system_events_widget.rb +4 -0
  30. data/lib/gui/fs_viewer_tab_widget.rb +245 -0
  31. data/lib/gui/i_device_syslog_thread.rb +47 -0
  32. data/lib/gui/images/check.png +0 -0
  33. data/lib/gui/images/folder.ico +0 -0
  34. data/lib/gui/images/iphone.ico +0 -0
  35. data/lib/gui/images/screenshot.png +0 -0
  36. data/lib/gui/key_chain_widget.rb +86 -0
  37. data/lib/gui/local_storage_tab_widget.rb +37 -0
  38. data/lib/gui/log_plain_text_edit.rb +18 -0
  39. data/lib/gui/log_widget.rb +71 -0
  40. data/lib/gui/main_tab_widget.rb +179 -0
  41. data/lib/gui/pasteboard_monitor_widget.rb +116 -0
  42. data/lib/gui/path_list_widget_item.rb +5 -0
  43. data/lib/gui/pb_watcher_thread.rb +63 -0
  44. data/lib/gui/plist_file_widget.rb +66 -0
  45. data/lib/gui/qt_ruby_variant.rb +16 -0
  46. data/lib/gui/screenshot_wizard.rb +169 -0
  47. data/lib/gui/settings_dialog.rb +69 -0
  48. data/lib/gui/settings_tab_widget.rb +149 -0
  49. data/lib/gui/shared_libraries_widget.rb +47 -0
  50. data/lib/gui/snoop_it_fs_events_widget.rb +150 -0
  51. data/lib/gui/snoop_it_keychain_widget.rb +172 -0
  52. data/lib/gui/snoop_it_sensitive_api_widget.rb +128 -0
  53. data/lib/gui/snoop_it_tab_widget.rb +27 -0
  54. data/lib/gui/snoop_it_update_thread.rb +48 -0
  55. data/lib/gui/sqlite_widget.rb +73 -0
  56. data/lib/gui/ssh_port_forward_tab_widget.rb +209 -0
  57. data/lib/gui/tool_widget.rb +94 -0
  58. data/lib/gui/url_handler_widget.rb +26 -0
  59. data/lib/gui/url_scheme_fuzz_widget.rb +103 -0
  60. data/lib/gui/url_scheme_widget.rb +60 -0
  61. data/lib/gui/weak_class_dump_widget.rb +89 -0
  62. data/lib/helper/ssh_port_forwarder.rb +72 -0
  63. data/lib/idb.rb +295 -0
  64. data/lib/idb/version.rb +3 -0
  65. data/lib/lib/CgBI.rb +153 -0
  66. data/lib/lib/abstract_device.rb +31 -0
  67. data/lib/lib/app.rb +286 -0
  68. data/lib/lib/app_binary.rb +57 -0
  69. data/lib/lib/ca_interface.rb +151 -0
  70. data/lib/lib/configuration.rb +0 -0
  71. data/lib/lib/console_launcher.rb +24 -0
  72. data/lib/lib/device.rb +438 -0
  73. data/lib/lib/device_ca_interface.rb +36 -0
  74. data/lib/lib/host_file_wrapper.rb +27 -0
  75. data/lib/lib/i_device_diagnostics_wrapper.rb +90 -0
  76. data/lib/lib/keychain_plist_parser.rb +15 -0
  77. data/lib/lib/local_operations.rb +67 -0
  78. data/lib/lib/otool_wrapper.rb +116 -0
  79. data/lib/lib/plist_util.rb +72 -0
  80. data/lib/lib/qt_thread_fix.rb +29 -0
  81. data/lib/lib/rsync_git_manager.rb +81 -0
  82. data/lib/lib/screen_shot_util.rb +59 -0
  83. data/lib/lib/settings.rb +67 -0
  84. data/lib/lib/simulator.rb +60 -0
  85. data/lib/lib/simulator_ca_interface.rb +16 -0
  86. data/lib/lib/snoop_it_wrapper.rb +80 -0
  87. data/lib/lib/ssh_operations.rb +136 -0
  88. data/lib/lib/ssh_port_forwarder.rb +43 -0
  89. data/lib/lib/tools.rb +11 -0
  90. data/lib/lib/url_scheme_fuzzer.rb +98 -0
  91. data/lib/lib/usb_muxd_wrapper.rb +32 -0
  92. data/lib/lib/weak_class_dump_wrapper.rb +62 -0
  93. data/lib/utils/dumpdecrypted/README +4 -0
  94. data/lib/utils/dumpdecrypted/dumpdecrypted_armv6.dylib +0 -0
  95. data/lib/utils/dumpdecrypted/dumpdecrypted_armv7.dylib +0 -0
  96. data/lib/utils/ios-ssl-kill-switch/com.isecpartners.nabla.sslkillswitch_v0.5-iOS_6.1.deb +0 -0
  97. data/lib/utils/keychain_dump/README +2 -0
  98. data/lib/utils/keychain_dump/keychain_dump +0 -0
  99. data/lib/utils/pbwatcher/pbwatcher +0 -0
  100. data/lib/utils/pcviewer/protectionclassviewer +0 -0
  101. data/lib/utils/weak_class_dump/README +5 -0
  102. data/lib/utils/weak_class_dump/weak_classdump.cy +726 -0
  103. metadata +412 -0
@@ -0,0 +1,27 @@
1
+ require_relative 'snoop_it_fs_events_widget'
2
+ require_relative 'snoop_it_keychain_widget'
3
+ require_relative 'snoop_it_sensitive_api_widget'
4
+
5
+
6
+ module Idb
7
+ class SnoopItTabWidget < Qt::TabWidget
8
+
9
+ def initialize *args
10
+ super *args
11
+
12
+ @tabs = Hash.new
13
+
14
+ @fsevents = SnoopItFSEventsWidget.new self
15
+ @tabs[:fsevents] = addTab(@fsevents, "File System Events")
16
+
17
+ @keychain = SnoopItKeychainWidget.new self
18
+ @tabs[:keychain] = addTab(@keychain, "Keychain Access")
19
+
20
+ @sensitiveapi = SnooptItSensitiveAPIWidget.new self
21
+ @tabs[:sensitiveapi] = addTab(@sensitiveapi, "Sensitive APIs")
22
+ end
23
+
24
+
25
+
26
+ end
27
+ end
@@ -0,0 +1,48 @@
1
+ module Idb
2
+ class SnoopItUpdateThread < Qt::Object
3
+ signals "new_events(QVariant)"
4
+ attr_accessor :thread
5
+
6
+ def initialize *args
7
+ super *args
8
+ STDOUT.sync = true
9
+
10
+ @snoop = SnoopItWrapper.new
11
+ end
12
+
13
+ def delete_all
14
+ begin
15
+ @snoop.fsevents_delete
16
+ rescue
17
+ puts "Connection lost"
18
+ end
19
+ end
20
+
21
+ def stream function
22
+ puts "Starting"
23
+ @id = 0
24
+
25
+
26
+ puts @id
27
+ t = Qt::Timer.new self
28
+ t.connect(SIGNAL(:timeout)) {
29
+ puts "triggered"
30
+ thread = Thread.new do
31
+ begin
32
+ events = @snoop.send(function, @id)
33
+ rescue
34
+ puts "Connection lost"
35
+ t.stop
36
+ thread.kill
37
+ end
38
+ @id = events.last["id"] unless events.last.nil?
39
+ puts @id
40
+ emit new_events(events.to_variant) unless events.nil?
41
+ end
42
+ thread.join
43
+ }
44
+ t.start(1000)
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,73 @@
1
+ require_relative '../lib/console_launcher'
2
+
3
+ module Idb
4
+ class SqliteWidget < Qt::Widget
5
+
6
+ def initialize *args
7
+ super *args
8
+
9
+ @refresh = Qt::PushButton.new "Refresh"
10
+ @refresh.connect(SIGNAL :released) {
11
+ refresh
12
+ }
13
+
14
+ @list = Qt::ListWidget.new self
15
+ @list.connect(SIGNAL('itemDoubleClicked(QListWidgetItem*)')) { |item|
16
+ if $settings['sqlite_editor'].nil? or $settings['sqlite_editor'] == ""
17
+ error = Qt::MessageBox.new
18
+ error.setInformativeText("Please configure a SQLite editor in the idb preferences.")
19
+ error.setIcon(Qt::MessageBox::Critical)
20
+ error.exec
21
+ else
22
+ cache_name = $selected_app.cache_file item.full_path
23
+ if cache_name.nil?
24
+ $log.error "File #{item.full_path} could not be downloaded. Either the file does not exist (e.g., dead symlink) or there is a permission problem."
25
+ else
26
+ if RbConfig::CONFIG['host_os'] =~ /linux/
27
+ Process.spawn "'#{$settings['sqlite_editor']}' '#{Dir.getwd}/#{cache_name}'"
28
+ else
29
+ Process.spawn "open -a '#{$settings['sqlite_editor']}' '#{Dir.getwd}/#{cache_name}'"
30
+ end
31
+ end
32
+
33
+ x = ConsoleLauncher.new
34
+ #TODO: find sqlite binary
35
+ #http://www.ruby-doc.org/stdlib-2.0.0/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-find_executable
36
+ #x.run "/usr/bin/sqlite3 #{Dir.getwd}/#{$selected_app.cache_file item.full_path}"
37
+ end
38
+
39
+
40
+
41
+ }
42
+ # "Launch app"
43
+
44
+ layout = Qt::VBoxLayout.new do |v|
45
+ v.add_widget(@list)
46
+ v.add_widget(@refresh)
47
+ end
48
+ setLayout(layout)
49
+ end
50
+
51
+ def clear
52
+ @list.clear
53
+ end
54
+
55
+
56
+ def refresh
57
+ @list.clear
58
+ sqlite_dbs = $selected_app.find_sqlite_dbs
59
+ sqlite_dbs.each { |full_path|
60
+ item = PathListWidgetItem.new
61
+ if $device.simulator?
62
+ item.setText full_path.sub($selected_app.app_dir,'')
63
+ else
64
+ pc = $device.protection_class full_path
65
+ item.setText full_path.sub($selected_app.app_dir,'') + " => " + pc.strip
66
+ end
67
+
68
+ item.full_path = full_path
69
+ @list.addItem item
70
+ }
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,209 @@
1
+ module Idb
2
+ class SSHPortForwardTabWidget < Qt::TabWidget
3
+
4
+
5
+ def initialize *args
6
+ super *args
7
+ setup_remote_port_forward
8
+ setup_local_port_forward
9
+ @forwarders_changed = false
10
+ end
11
+
12
+
13
+ def add_remote_forward_to_list remote_port, local_port, local_host
14
+ @remote_forward_list.addItem Qt::ListWidgetItem.new "remote:#{remote_port} -> #{local_host}:#{local_port}"
15
+ end
16
+
17
+ def add_local_forward_to_list local_port, remote_port, remote_host
18
+ @local_forward_list.addItem Qt::ListWidgetItem.new "local:#{local_port} -> #{remote_host}:#{remote_port}"
19
+ end
20
+
21
+
22
+ def setup_local_port_forward
23
+ @local_forward_tab = Qt::Widget.new self
24
+ forward_config_layout = Qt::GridLayout.new
25
+ @local_forward_tab.setLayout forward_config_layout
26
+ addTab(@local_forward_tab,"Local")
27
+
28
+ @local_forward_tab.setLayout(forward_config_layout)
29
+
30
+ @local_forward_list = Qt::ListWidget.new @local_forward_tab
31
+ forward_config_layout.addWidget @local_forward_list, 0, 0, 2, 2
32
+
33
+
34
+ if $settings['local_forwards'].nil?
35
+ $settings['local_forwards'] = Array.new
36
+ end
37
+
38
+ $settings['local_forwards'].each {|x|
39
+ add_local_forward_to_list x['local_port'], x['remote_port'], x['remote_host']
40
+ }
41
+
42
+
43
+ add_forward_button = Qt::PushButton.new "Add"
44
+ add_forward_button.connect(SIGNAL(:released)) {
45
+ local_port = @local_local_port_text.text
46
+ remote_port = @local_remote_port_text.text
47
+ remote_host = @local_remote_host_text.text
48
+
49
+ if is_valid_port(remote_port) and is_valid_port(local_port)
50
+ @forwarders_changed = true
51
+ add_local_forward_to_list local_port, remote_port, remote_host
52
+
53
+ item = Hash.new
54
+ item['local_port'] = @local_local_port_text.text
55
+ item['remote_port'] = @local_remote_port_text.text
56
+ item['remote_host'] = @local_remote_host_text.text
57
+ $settings['local_forwards'] << item
58
+ $settings.store
59
+
60
+
61
+ @local_local_port_text.text = ""
62
+ @local_remote_port_text.text = ""
63
+ @local_remote_host_text.text = ""
64
+ end
65
+ }
66
+ remove_forward_button = Qt::PushButton.new "Remove"
67
+ remove_forward_button.connect(SIGNAL(:released)) {
68
+ unless @local_forward_list.current_row.nil?
69
+ @forwarders_changed = true
70
+ row = @local_forward_list.current_row
71
+ @local_forward_list.takeItem row
72
+ $settings['local_forwards'].delete_at(row)
73
+ $settings.store
74
+ end
75
+
76
+ }
77
+
78
+ forward_config_layout.addWidget add_forward_button, 0, 3
79
+ forward_config_layout.addWidget remove_forward_button, 1, 3
80
+
81
+ local_port_label = Qt::Label.new "Local Port"
82
+ @local_local_port_text = Qt::LineEdit.new
83
+
84
+
85
+ remote_host_label = Qt::Label.new "Remote Host"
86
+ @local_remote_host_text = Qt::LineEdit.new
87
+
88
+
89
+ remote_port_label = Qt::Label.new "Remote Port"
90
+ @local_remote_port_text = Qt::LineEdit.new
91
+
92
+ forward_config_layout.addWidget local_port_label, 2, 0
93
+ forward_config_layout.addWidget @local_local_port_text, 2, 1
94
+
95
+
96
+ forward_config_layout.addWidget remote_host_label, 3, 0
97
+ forward_config_layout.addWidget @local_remote_host_text, 3, 1
98
+
99
+
100
+ forward_config_layout.addWidget remote_port_label, 4, 0
101
+ forward_config_layout.addWidget @local_remote_port_text, 4, 1
102
+
103
+ end
104
+
105
+
106
+
107
+ def setup_remote_port_forward
108
+ @remote_forward_tab = Qt::Widget.new self
109
+ forward_config_layout = Qt::GridLayout.new
110
+ @remote_forward_tab.setLayout forward_config_layout
111
+ addTab(@remote_forward_tab,"Remote")
112
+
113
+ @remote_forward_tab.setLayout(forward_config_layout)
114
+
115
+
116
+ @remote_forward_list = Qt::ListWidget.new @forward_config
117
+ forward_config_layout.addWidget @remote_forward_list, 0, 0, 2, 2
118
+
119
+
120
+ if $settings['remote_forwards'].nil?
121
+ $settings['remote_forwards'] = Array.new
122
+ end
123
+
124
+ $settings['remote_forwards'].each {|x|
125
+ add_remote_forward_to_list x['remote_port'], x['local_port'], x['local_host']
126
+ }
127
+
128
+
129
+ add_forward_button = Qt::PushButton.new "Add"
130
+ add_forward_button.connect(SIGNAL(:released)) {
131
+ remote_port = @remote_remote_port_text.text
132
+ local_port = @remote_local_port_text.text
133
+ local_host = @remote_local_host_text.text
134
+
135
+ if is_valid_port(remote_port) and is_valid_port(local_port)
136
+ add_remote_forward_to_list remote_port, local_port, local_host
137
+ @forwarders_changed = true
138
+
139
+ item = Hash.new
140
+ item['remote_port'] = @remote_remote_port_text.text
141
+ item['local_port'] = @remote_local_port_text.text
142
+ item['local_host'] = @remote_local_host_text.text
143
+ $settings['remote_forwards'] << item
144
+ $settings.store
145
+
146
+
147
+ @remote_remote_port_text.text = ""
148
+ @remote_local_port_text.text = ""
149
+ @remote_local_host_text.text = ""
150
+ end
151
+ }
152
+ remove_forward_button = Qt::PushButton.new "Remove"
153
+ remove_forward_button.connect(SIGNAL(:released)) {
154
+ if not @remote_forward_list.current_row.nil?
155
+ @forwarders_changed = true
156
+ row = @remote_forward_list.current_row
157
+ @remote_forward_list.takeItem row
158
+ $settings['remote_forwards'].delete_at(row)
159
+ $settings.store
160
+ end
161
+
162
+ }
163
+
164
+ forward_config_layout.addWidget add_forward_button, 0, 3
165
+ forward_config_layout.addWidget remove_forward_button, 1, 3
166
+
167
+ remote_port_label = Qt::Label.new "Remote Port"
168
+ @remote_remote_port_text = Qt::LineEdit.new
169
+
170
+
171
+ local_host_label = Qt::Label.new "Local Host"
172
+ @remote_local_host_text = Qt::LineEdit.new
173
+
174
+
175
+ local_port_label = Qt::Label.new "Local Port"
176
+ @remote_local_port_text = Qt::LineEdit.new
177
+
178
+ forward_config_layout.addWidget remote_port_label, 2, 0
179
+ forward_config_layout.addWidget @remote_remote_port_text, 2, 1
180
+
181
+
182
+ forward_config_layout.addWidget local_host_label, 3, 0
183
+ forward_config_layout.addWidget @remote_local_host_text, 3, 1
184
+
185
+
186
+ forward_config_layout.addWidget local_port_label, 4, 0
187
+ forward_config_layout.addWidget @remote_local_port_text, 4, 1
188
+
189
+ end
190
+
191
+
192
+ def is_valid_port port
193
+ begin
194
+ if not Integer(port) or Integer(port) > 2**16 or Integer(port) < 1
195
+ return false
196
+ else
197
+ return true
198
+ end
199
+ rescue
200
+ false
201
+ end
202
+ end
203
+
204
+ def forwarders_changed?
205
+ @forwarders_changed
206
+ end
207
+ end
208
+
209
+ end
@@ -0,0 +1,94 @@
1
+ require_relative 'screenshot_wizard'
2
+ require_relative '../lib/host_file_wrapper'
3
+
4
+ module Idb
5
+ class ToolWidget < Qt::Widget
6
+
7
+ def initialize *args
8
+ super *args
9
+
10
+ layout = Qt::VBoxLayout.new
11
+ setLayout(layout)
12
+
13
+
14
+ @screen_shot_box = Qt::GroupBox.new "Screenshot Tool"
15
+ @screen_shot_description = Qt::Label.new "iOS takes an automatic screenshot whenever an app is placed into the background. This Wizard walks you through the steps that are required verify that the assessed app properly protects sensitive data before backgrounding."
16
+ @screen_shot_description.setWordWrap true
17
+
18
+ @screen_shot_button = Qt::PushButton.new "Check for Automatic Background Screenshot"
19
+ @screen_shot_button.connect(SIGNAL :released) {
20
+ tool = ScreenShotWizard::ScreenShotWizard.new_with_app $selected_app
21
+ }
22
+
23
+ screen_shot_layout = Qt::GridLayout.new
24
+ @screen_shot_box.setLayout(screen_shot_layout)
25
+ screen_shot_layout.addWidget @screen_shot_description, 0, 0
26
+ screen_shot_layout.addWidget @screen_shot_button, 1, 0
27
+
28
+ layout.addWidget @screen_shot_box
29
+
30
+
31
+ @cert_box = Qt::GroupBox.new "Certificate Manager"
32
+ @cert_description = Qt::Label.new "This tool allows you to manage SSL CA certificates both on iOS devices and the iOS simulator. For devices, the certificates are installed via Safari and a private web server run by idb. For the simulator they are directly stored in the simulator's truststore. Please report any problems with either system on github."
33
+ @cert_description.setWordWrap true
34
+
35
+ @cert_button = Qt::PushButton.new "Launch Certificate Manager"
36
+ @cert_button.connect(SIGNAL :released) {
37
+ ca = CAManagerDialog.new self
38
+ ca.exec
39
+ }
40
+
41
+ @burp_description = Qt::Label.new "Running the iDevice through burp? Click below to install the Portswigger CA certificate on the device by opening the http://burp/cert URL handler."
42
+ @burp_description.setWordWrap true
43
+ @burp_button = Qt::PushButton.new "Install Burp Cert"
44
+ @burp_button.connect(SIGNAL :released) {
45
+ $device.open_url "http://burp/cert"
46
+ }
47
+
48
+ cert_layout = Qt::GridLayout.new
49
+ @cert_box.setLayout(cert_layout)
50
+ cert_layout.addWidget @cert_description, 0, 0, 1, 2
51
+ cert_layout.addWidget @cert_button, 1, 0
52
+ cert_layout.addWidget @burp_button, 1, 1
53
+
54
+ layout.addWidget @cert_box
55
+
56
+
57
+ @host_editor_box = Qt::GroupBox.new "/etc/hosts File Editor"
58
+
59
+ @host_file_text = Qt::PlainTextEdit.new
60
+ @host_wrapper = HostFileWrapper.new
61
+
62
+ @host_editor_save_button = Qt::PushButton.new "Save"
63
+ @host_editor_save_button.connect(SIGNAL :released) {
64
+ @host_wrapper.save @host_file_text.plainText
65
+ }
66
+
67
+ @host_editor_reset_button = Qt::PushButton.new "Load"
68
+ @host_editor_reset_button.connect(SIGNAL :released) {
69
+ @host_file_text.clear
70
+ @host_file_text.appendPlainText @host_wrapper.content
71
+ }
72
+
73
+ host_editor_layout = Qt::GridLayout.new
74
+ @host_editor_box.setLayout(host_editor_layout)
75
+ host_editor_layout.addWidget @host_file_text, 0, 0, 1, 2
76
+ host_editor_layout.addWidget @host_editor_reset_button, 1, 0
77
+ host_editor_layout.addWidget @host_editor_save_button, 1, 1
78
+
79
+ layout.addWidget @host_editor_box
80
+
81
+
82
+
83
+
84
+ @spacer = Qt::SpacerItem.new 0,1, Qt::SizePolicy::Fixed, Qt::SizePolicy::Expanding
85
+ layout.addItem @spacer
86
+ end
87
+
88
+ def enable_screenshot
89
+ @screen_shot_button.setEnabled(true)
90
+
91
+ end
92
+
93
+ end
94
+ end