idb 1.3.1

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.
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,16 @@
1
+ module Idb
2
+ class Qt::RubyVariant < Qt::Variant
3
+ def initialize(value)
4
+ super()
5
+ @value = value
6
+ end
7
+
8
+ attr_accessor :value
9
+ end
10
+
11
+ class Object
12
+ def to_variant
13
+ Qt::RubyVariant.new self
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,169 @@
1
+ require_relative '../lib/screen_shot_util'
2
+ require 'Qt'
3
+
4
+ module Idb
5
+ module ScreenShotWizard
6
+ Pages = Hash.new
7
+ wizard = nil
8
+
9
+
10
+ class ScreenShotWizard < Qt::Wizard
11
+ attr_accessor :app, :screenshot, :result
12
+
13
+
14
+ def self.new_with_app app
15
+ wiz = self.new
16
+ wiz.app = app
17
+ wiz.screenshot = ScreenShotUtil.new app.app_dir, $device.ops, false
18
+ wiz
19
+ end
20
+
21
+ def initialize
22
+ super
23
+
24
+ Pages[:intro] = add_page(IntroPage.new)
25
+ Pages[:open_app] = add_page(OpenAppPage.new self)
26
+ Pages[:background_app] = add_page(BackgroundAppPage.new self)
27
+ Pages[:screen_shot_found] = add_page(ScreenShotFoundPage.new self)
28
+ Pages[:no_screen_shot] = add_page(NoScreenShotPage.new self)
29
+ set_window_title("Screenshot Wizard")
30
+ wizard = self
31
+ show
32
+ end
33
+ end
34
+
35
+
36
+ class IntroPage < Qt::WizardPage
37
+ def initialize
38
+ super
39
+
40
+ setTitle("Introduction")
41
+ label = Qt::Label.new("This wizard will guide you through the testing for the iOS backgrounding screenshot vulnerability.")
42
+ label.word_wrap = true
43
+ layout = Qt::VBoxLayout.new do |v|
44
+ v.add_widget(label)
45
+ end
46
+ setLayout(layout)
47
+ end
48
+
49
+ def validatePage
50
+ puts "[*] Marking screenshot time"
51
+ #wiz = parentWidget.parentWidget.parentWidget
52
+ wizard.screenshot.mark
53
+ return true
54
+ end
55
+ end
56
+
57
+ class OpenAppPage < Qt::WizardPage
58
+
59
+ def initialize *args
60
+ super *args
61
+
62
+ setTitle("Launch Application")
63
+ label = Qt::Label.new("Launch the application and navigate to a view that contains potentially sensitive data. Or click below to launch the app automatically.")
64
+ label.word_wrap = true
65
+
66
+ launch_button = Qt::PushButton.new "Launch app"
67
+ launch_button.connect(SIGNAL :released) { |x|
68
+ wizard.app.launch
69
+ }
70
+
71
+ layout = Qt::VBoxLayout.new do |v|
72
+ v.add_widget(label)
73
+ v.add_widget(launch_button)
74
+ end
75
+ setLayout(layout)
76
+
77
+ end
78
+
79
+
80
+ end
81
+
82
+
83
+ class BackgroundAppPage < Qt::WizardPage
84
+
85
+ def initialize *args
86
+ super *args
87
+ setTitle("Background App")
88
+
89
+ label = Qt::Label.new("Now Background the app by hitting the home button (XX in the simulator). Then click continue.")
90
+ label.word_wrap = true
91
+ layout = Qt::VBoxLayout.new do |v|
92
+ v.add_widget(label)
93
+ end
94
+ setLayout(layout)
95
+ end
96
+
97
+ def validatePage
98
+ puts "[*] Checking for screenshot"
99
+ #wiz = parentWidget.parentWidget.parentWidget
100
+ wizard.result = wizard.screenshot.check
101
+ puts wizard.result
102
+ true
103
+ end
104
+
105
+ def nextId
106
+ #wiz = parentWidget.parentWidget.parentWidget
107
+ puts "Determining next id"
108
+ if wizard.result.nil?
109
+ Pages[:no_screen_shot]
110
+ else
111
+ Pages[:screen_shot_found]
112
+ end
113
+ end
114
+
115
+
116
+ end
117
+
118
+ class NoScreenShotPage < Qt::WizardPage
119
+ def initialize *args
120
+ super *args
121
+ setFinalPage(true)
122
+ setTitle("No Screenshot Found")
123
+ label = Qt::Label.new("No new screenshot was detected for this application.")
124
+ label.word_wrap = true
125
+ layout = Qt::VBoxLayout.new do |v|
126
+ v.add_widget(label)
127
+ end
128
+ setLayout(layout)
129
+ end
130
+
131
+ def nextId
132
+ -1
133
+ end
134
+ end
135
+
136
+ class ScreenShotFoundPage < Qt::WizardPage
137
+ def initialize *args
138
+ super *args
139
+ setFinalPage(true)
140
+ end
141
+
142
+ def initializePage *args
143
+ super *args
144
+
145
+ #wiz = parentWidget.parentWidget.parentWidget
146
+ screenshot_file = wizard.app.cache_file wizard.result
147
+
148
+ setTitle("Screenshot Found (click to open)")
149
+ screen = Qt::Pixmap.new screenshot_file
150
+ button = Qt::PushButton.new
151
+ button.setFlat(true)
152
+ button.setIcon(Qt::Icon.new(screen))
153
+ button.setIconSize(parentWidget.size)
154
+ button.connect(SIGNAL :released) { |x|
155
+ $device.ops.open screenshot_file
156
+ }
157
+ layout = Qt::VBoxLayout.new do |v|
158
+ v.add_widget(button)
159
+ end
160
+ setLayout(layout)
161
+ end
162
+ end
163
+
164
+
165
+ def nextId
166
+ -1
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,69 @@
1
+ require_relative 'settings_tab_widget'
2
+
3
+
4
+ module Idb
5
+ class SettingsDialog < Qt::Dialog
6
+
7
+ def initialize *args
8
+ super *args
9
+
10
+ @layout = Qt::GridLayout.new
11
+ setLayout(@layout)
12
+ setWindowTitle("Settings")
13
+
14
+ @tabs = SettingsTabWidget.new self
15
+ @layout.addWidget @tabs, 0,0,1,2
16
+
17
+ @save_button = Qt::PushButton.new "Save"
18
+ @save_button.setDefault true
19
+
20
+ @save_button.connect(SIGNAL(:released)) {|x|
21
+ $settings["ssh_host"] = @tabs.ssh_host.text
22
+ $settings["ssh_port"] = @tabs.ssh_port.text
23
+ $settings["ssh_username"] = @tabs.ssh_username.text
24
+ $settings["ssh_password"] = @tabs.ssh_password.text
25
+
26
+ if @tabs.usbmux_radio.isChecked
27
+ $settings["device_connection_mode"] = "usb"
28
+ else
29
+ $settings["device_connection_mode"] = "ssh"
30
+ end
31
+
32
+ $settings["manual_ssh_port"] = @tabs.manual_ssh_port.text
33
+ $settings["idb_utility_port"] = @tabs.idb_utility_port.text
34
+ $settings["sqlite_editor"] = @tabs.sqlite_editor.text
35
+
36
+ $settings.store
37
+
38
+ if not $device.nil? and forwarders_changed?
39
+ reply = Qt::MessageBox::question(self, "Reload Port Forwards", "Portforwarding has changed. Do you want to apply the new configuration?<br>(This may interrupt existing connections)", Qt::MessageBox::Yes, Qt::MessageBox::No);
40
+ if reply == Qt::MessageBox::Yes
41
+ $device.restart_port_forwarding
42
+ end
43
+ end
44
+
45
+ accept()
46
+ }
47
+ @cancel_button = Qt::PushButton.new "Cancel"
48
+ @cancel_button.connect(SIGNAL(:released)) {|x|
49
+ reject()
50
+ }
51
+
52
+ @layout.addWidget @save_button, 2, 1
53
+ @layout.addWidget @cancel_button, 2, 0
54
+
55
+
56
+
57
+
58
+
59
+
60
+ end
61
+ #
62
+ def forwarders_changed?
63
+ @tabs.forwarders_changed?
64
+ end
65
+
66
+
67
+
68
+ end
69
+ end
@@ -0,0 +1,149 @@
1
+ require_relative 'ssh_port_forward_tab_widget'
2
+
3
+ module Idb
4
+ class SettingsTabWidget < Qt::TabWidget
5
+ attr_accessor :ssh_host, :ssh_port, :ssh_username, :ssh_password, :usbmux_radio, :manual_ssh_port, :idb_utility_port
6
+ attr_accessor :sqlite_editor
7
+
8
+ def initialize *args
9
+ super *args
10
+
11
+ setup_device_config
12
+ addTab @device_config_tab, "Device Config"
13
+ setup_forwards
14
+ addTab @forward_config, "Port Forwarding"
15
+ setup_external_apps
16
+ addTab @external_apps_config, "External Editors"
17
+
18
+ end
19
+
20
+ def setup_device_config
21
+ @device_config_tab = Qt::Widget.new self
22
+ device_config_layout = Qt::GridLayout.new
23
+ @device_config_tab.setLayout device_config_layout
24
+
25
+ device_config_layout.addWidget @device_config, 0, 0, 1,2
26
+
27
+
28
+ @connection_widget = Qt::Widget.new self
29
+ @connection_widget_layout = Qt::GridLayout.new
30
+ @connection_widget.setLayout(@connection_widget_layout)
31
+ device_config_layout.addWidget @connection_widget, 0, 0, 1, 2
32
+
33
+ @ssh_direct_radio = Qt::RadioButton.new @connection_widget
34
+ @ssh_direct_radio.setText("SSH directly")
35
+ @ssh_direct_radio.connect(SIGNAL :released) {
36
+ @ssh_host.setEnabled(true)
37
+
38
+ }
39
+
40
+ @usbmux_radio = Qt::RadioButton.new @connection_widget
41
+ @usbmux_radio.setText("SSH via USB (usbmuxd)")
42
+ @usbmux_radio.connect(SIGNAL :released) {
43
+ @ssh_host.setEnabled(false)
44
+ }
45
+
46
+ @connection_widget_layout.addWidget @ssh_direct_radio, 0,0
47
+ @connection_widget_layout.addWidget @usbmux_radio, 0, 1
48
+
49
+
50
+
51
+ # ssh username
52
+ @label_ssh_username = Qt::Label.new "SSH Username:", self, 0
53
+ @ssh_username = Qt::LineEdit.new $settings.ssh_username
54
+ device_config_layout.addWidget @label_ssh_username, 1, 0
55
+ device_config_layout.addWidget @ssh_username, 1, 1
56
+
57
+ # ssh password
58
+ @label_ssh_password = Qt::Label.new "SSH Password:", self, 0
59
+ @ssh_password = Qt::LineEdit.new $settings.ssh_password
60
+ device_config_layout.addWidget @label_ssh_password, 2, 0
61
+ device_config_layout.addWidget @ssh_password, 2, 1
62
+
63
+ # ssh host
64
+ @label_ssh_host = Qt::Label.new "SSH Host:", self, 0
65
+ @ssh_host = Qt::LineEdit.new $settings.ssh_host
66
+ device_config_layout.addWidget @label_ssh_host, 3, 0
67
+ device_config_layout.addWidget @ssh_host, 3, 1
68
+
69
+ # ssh port
70
+ @label_ssh_port = Qt::Label.new "SSH Port:", self, 0
71
+ @ssh_port = Qt::LineEdit.new $settings.ssh_port.to_s
72
+ device_config_layout.addWidget @label_ssh_port, 4, 0
73
+ device_config_layout.addWidget @ssh_port, 4, 1
74
+
75
+
76
+ if $settings['device_connection_mode'] == "usb"
77
+ @usbmux_radio.setChecked(true)
78
+ @ssh_host.setEnabled(false)
79
+ end
80
+
81
+
82
+ if $settings['device_connection_mode'] == "ssh"
83
+ @ssh_direct_radio.setChecked(true)
84
+ end
85
+
86
+ end
87
+
88
+ def setup_forwards
89
+
90
+ @forward_config = Qt::Widget.new self
91
+ forward_config_layout = Qt::GridLayout.new
92
+ @forward_config.setLayout forward_config_layout
93
+
94
+ @forward_tabs = SSHPortForwardTabWidget.new self
95
+ forward_config_layout.addWidget @forward_tabs, 0, 0, 1, 2
96
+
97
+ # manual SSH port
98
+ @label_manual_ssh_port = Qt::Label.new "Port for Manual SSH:", self, 0
99
+ @manual_ssh_port = Qt::LineEdit.new $settings.manual_ssh_port.to_s
100
+ forward_config_layout.addWidget @label_manual_ssh_port, 2, 0
101
+ forward_config_layout.addWidget @manual_ssh_port, 2, 1
102
+
103
+ # idb utility forward port
104
+ @label_idb_utility_port = Qt::Label.new "Port for internal idb operations:", self, 0
105
+ @idb_utility_port = Qt::LineEdit.new $settings.idb_utility_port.to_s
106
+ forward_config_layout.addWidget @label_idb_utility_port, 3, 0
107
+ forward_config_layout.addWidget @idb_utility_port, 3, 1
108
+
109
+ end
110
+
111
+ def setup_external_apps
112
+ @external_apps_config = Qt::Widget.new self
113
+ external_apps_config_layout = Qt::GridLayout.new
114
+ @external_apps_config.setLayout external_apps_config_layout
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ # sqlite editor
124
+ @label_sqlite_editor = Qt::Label.new "SQLite Editor:", self, 0
125
+ @sqlite_editor = Qt::Label.new $settings.sqlite_editor
126
+ @sqlite_editor_change = Qt::PushButton.new "Change"
127
+
128
+ @sqlite_editor_change.connect(SIGNAL :released) {
129
+ file_dialog = Qt::FileDialog.new
130
+ file_dialog.setAcceptMode(Qt::FileDialog::AcceptOpen)
131
+
132
+ file_dialog.connect(SIGNAL('fileSelected(QString)')) { |x|
133
+ @sqlite_editor.setText x
134
+ }
135
+ file_dialog.exec
136
+ }
137
+ external_apps_config_layout.addWidget @label_sqlite_editor, 1, 0
138
+ external_apps_config_layout.addWidget @sqlite_editor, 1, 1
139
+ external_apps_config_layout.addWidget @sqlite_editor_change, 1, 2
140
+
141
+ end
142
+
143
+ def forwarders_changed?
144
+ @forward_tabs.forwarders_changed?
145
+ end
146
+
147
+
148
+ end
149
+ end
@@ -0,0 +1,47 @@
1
+ module Idb
2
+ class SharedLibrariesWidget < Qt::Widget
3
+ def initialize *args
4
+ super *args
5
+
6
+ @refresh = Qt::PushButton.new "Refresh"
7
+ @refresh.connect(SIGNAL :released) {
8
+ refresh
9
+ }
10
+
11
+ @list = Qt::ListWidget.new self
12
+
13
+ layout = Qt::VBoxLayout.new do |v|
14
+ v.add_widget(@list)
15
+ v.add_widget(@refresh)
16
+ end
17
+ setLayout(layout)
18
+ end
19
+
20
+ def clear
21
+ @list.clear
22
+ end
23
+
24
+ def refresh
25
+ @list.clear
26
+ if not $selected_app.binary.nil?
27
+ shared_lib = $selected_app.binary.get_shared_libraries
28
+ if shared_lib.nil?
29
+ item = Qt::ListWidgetItem.new
30
+ item.setText "Error: otool required"
31
+ @list.addItem item
32
+ return
33
+ end
34
+ shared_lib.each { |lib|
35
+ item = Qt::ListWidgetItem.new
36
+ item.setText lib
37
+ @list.addItem item
38
+ }
39
+ setEnabled(true)
40
+ else
41
+ setEnabled(false)
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end