forked from dmayer/idb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp_details_group_box.rb
212 lines (159 loc) · 5.58 KB
/
app_details_group_box.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
require_relative '../lib/app'
class AppDetailsGroupBox < Qt::GroupBox
attr_accessor :uuid, :bundle_id
signals "app_changed()"
signals "show_device_status()"
def initialize args
super *args
# details on selected app
@layout = Qt::GridLayout.new
setLayout(@layout)
setTitle "App Details"
@icon_button_layout = Qt::GridLayout.new
# select app
@select_app_button = Qt::PushButton.new "Select App..."
@select_app_button.setEnabled(false)
@select_app_button.connect(SIGNAL(:released)) { |x|
@app_list = AppListDialog.new
@app_list.connect(SIGNAL('accepted()')) {
$selected_app = @app_list.app_list.currentItem().app
@vals['uuid'].setText($selected_app.uuid)
@vals['bundle_id'].setText($selected_app.bundle_id)
@vals['bundle_name'].setText($selected_app.bundle_name)
@vals['url_handlers'].setText($selected_app.get_url_handlers.join("\n"))
@vals['platform_version'].setText($selected_app.platform_version)
@vals['sdk_version'].setText($selected_app.sdk_version)
@vals['minimum_os_version'].setText($selected_app.minimum_os_version)
@launch_app.setEnabled(true)
@open_folder.setEnabled(true)
begin
icon_file = $selected_app.get_icon_file
pixmap = Qt::Pixmap.new(icon_file)
@icon.setPixmap pixmap.scaledToWidth(50) unless icon_file.nil?
rescue => e
$log.error "Icon CONVERSION failed. #{e.message}"
@icon.setPixmap Qt::Pixmap.new
# lets ignore conversion errors for now..
end
emit app_changed()
}
@app_list.exec
}
@icon_button_widget = Qt::Widget.new self
@icon_button_widget.setLayout @icon_button_layout
@icon = Qt::Label.new
@icon_button_layout.addWidget @icon, 0, 0, 1, 1
@icon_button_layout.addWidget @select_app_button, 0, 1, 1, 3
@layout.addWidget @icon_button_widget, 0, 0, 1, 2
@labels = Hash.new
@vals = Hash.new
@cur_row = 1
addDetail 'bundle_id', 'Bundle ID'
addDetail 'bundle_name', 'Bundle Name'
addDetail 'uuid', 'UUID'
addDetail 'url_handlers', 'URL Handlers'
addDetail 'platform_version', 'Platform Version'
addDetail 'sdk_version', 'SDK Version'
addDetail 'minimum_os_version', 'Minimum OS'
@launch_app = Qt::PushButton.new "Launch App"
@launch_app.setEnabled(false)
@launch_app.connect(SIGNAL(:released)) {
if $device.open_installed?
$selected_app.launch
else
error = Qt::MessageBox.new self
error.setInformativeText("'open' not found on the device. Please visit the status dialog and install it.")
error.setIcon(Qt::MessageBox::Critical)
error.setMinimumWidth(500)
error.exec
emit show_device_status()
end
}
@layout.addWidget @launch_app, @cur_row, 0, 1, 2
@cur_row+=1
@open_folder = Qt::PushButton.new "Open Local Temp Folder"
@open_folder.setEnabled(false)
@layout.addWidget @open_folder, @cur_row, 0, 1, 2
@open_folder.connect(SIGNAL :released) {
Launchy.open $selected_app.cache_dir
}
end
def clear
$selected_app = nil
@vals['uuid'].setText("")
@vals['bundle_id'].setText("")
@vals['bundle_name'].setText("")
@vals['url_handlers'].setText("")
@vals['platform_version'].setText("")
@vals['sdk_version'].setText("")
@vals['minimum_os_version'].setText("")
@launch_app.setEnabled(false)
@open_folder.setEnabled(false)
end
def addDetail id, label
@labels[id] = Qt::Label.new "<b>#{label}</b>", self, 0
@vals[id] = Qt::Label.new "", self, 0
@layout.addWidget @labels[id], @cur_row, 0
@layout.addWidget @vals[id], @cur_row, 1
@cur_row += 1
end
def enable_select_app
@select_app_button.setEnabled(true)
end
def disable_select_app
@select_app_button.setEnabled(false)
end
end
class AppBinaryGroupBox < Qt::GroupBox
signals "binary_analyzed()"
def initialize args
super *args
# details on selected app
@layout = Qt::GridLayout.new
setLayout(@layout)
setTitle "App Binary"
# analyze binary
@analyze_binary_button = Qt::PushButton.new "Analyze Binary..."
@analyze_binary_button.setEnabled(false)
@analyze_binary_button.connect(SIGNAL(:released)) { |x|
#TODO progress bar
$selected_app.analyze
@vals['encryption_enabled'].setText($selected_app.binary.is_encrypted?.to_s)
@vals['cryptid'].setText($selected_app.binary.get_cryptid.to_s)
@vals['pie'].setText($selected_app.binary.is_pie?.to_s)
@vals['canaries'].setText($selected_app.binary.is_stack_protected?.to_s)
@vals['arc'].setText($selected_app.binary.uses_arc?.to_s)
emit binary_analyzed()
}
@layout.addWidget @analyze_binary_button, 0, 0, 1, 2
@labels = Hash.new
@vals = Hash.new
@cur_row = 1
addDetail 'encryption_enabled', 'Encryption?'
addDetail 'cryptid', 'Cryptid'
addDetail 'pie', 'PIE'
addDetail 'canaries', 'Stack Canaries'
addDetail 'arc', 'ARC'
end
def addDetail id, label
@labels[id] = Qt::Label.new "<b>#{label}</b>", self, 0
@vals[id] = Qt::Label.new "", self, 0
@layout.addWidget @labels[id], @cur_row, 0
@layout.addWidget @vals[id], @cur_row, 1
@cur_row += 1
end
def app_changed
clear
@analyze_binary_button.setEnabled(true)
end
def clear
@vals['encryption_enabled'].setText("")
@vals['cryptid'].setText("")
@vals['pie'].setText("")
@vals['canaries'].setText("")
@vals['arc'].setText("")
end
def disable_analyze_binary
@analyze_binary_button.setEnabled(false)
end
end