Class: Watobo::Gui::Dashboard
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::Dashboard
show all
- Includes:
- Icons
- Defined in:
- lib/watobo/gui/dashboard.rb
Constant Summary
Constants included
from Icons
Icons::ICON_ADD_PROJECT, Icons::ICON_BROWSER_MEDIUM, Icons::ICON_BROWSER_SMALL, Icons::ICON_BTN_DOWN, Icons::ICON_BTN_UP, Icons::ICON_CB_CHECKED, Icons::ICON_CB_CHECKED_ORANGE, Icons::ICON_CB_UNCHECKED, Icons::ICON_CONVERSATION, Icons::ICON_DASHBOARD, Icons::ICON_DIFFER, Icons::ICON_FOLDER, Icons::ICON_FOLDER_SMALL, Icons::ICON_FUZZER, Icons::ICON_FUZZER_MEDIUM, Icons::ICON_FUZZER_SMALL, Icons::ICON_FUZZ_FILTER, Icons::ICON_FUZZ_GENERATOR, Icons::ICON_FUZZ_TAG, Icons::ICON_HINTS, Icons::ICON_HINTS_INFO, Icons::ICON_HINTS_INFO_SMALL, Icons::ICON_HINTS_SMALL, Icons::ICON_INFO, Icons::ICON_INFO_INFO, Icons::ICON_INFO_INFO_SMALL, Icons::ICON_INFO_SMALL, Icons::ICON_INFO_USER, Icons::ICON_INFO_USER_SMALL, Icons::ICON_INTERCEPTOR, Icons::ICON_LOGIN_WIZZARD, Icons::ICON_MANUAL_REQUEST, Icons::ICON_MANUAL_REQUEST_MEDIUM, Icons::ICON_MANUAL_REQUEST_SMALL, Icons::ICON_PAUSE, Icons::ICON_PLUGIN, Icons::ICON_PROJECT, Icons::ICON_PROJECT_SMALL, Icons::ICON_REPORT, Icons::ICON_REQUEST, Icons::ICON_REQUEST_SMALL, Icons::ICON_SEND_REQUEST, Icons::ICON_SITE, Icons::ICON_SITE_SMALL, Icons::ICON_START, Icons::ICON_STOP, Icons::ICON_TOKEN, Icons::ICON_TRANSCODER, Icons::ICON_VULN, Icons::ICON_VULN_BP, Icons::ICON_VULN_BP_SMALL, Icons::ICON_VULN_CRITICAL, Icons::ICON_VULN_CRITICAL_SMALL, Icons::ICON_VULN_HIGH, Icons::ICON_VULN_HIGH_SMALL, Icons::ICON_VULN_LOW, Icons::ICON_VULN_LOW_SMALL, Icons::ICON_VULN_MEDIUM, Icons::ICON_VULN_MEDIUM_SMALL, Icons::ICON_VULN_SMALL, Icons::ICON_WATOBO, Icons::SIBERAS_ICON, Icons::TBL_ICON_LOCK, Icons::WATOBO_LOGO
Instance Method Summary
collapse
Constructor Details
#initialize(parent) ⇒ Dashboard
Returns a new instance of Dashboard.
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
# File 'lib/watobo/gui/dashboard.rb', line 287
def initialize(parent)
begin
super(parent, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN)
@scanner = nil
@progress_lock = Mutex.new
main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
main.backColor = FXColor::White
frame = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X|FRAME_GROOVE)
frame.backColor = FXColor::White
title_icon = FXButton.new(frame, '', ICON_DASHBOARD, :opts => FRAME_NONE)
title_icon.backColor = FXColor::White
@font_title = FXFont.new(getApp(), "helvetica", 14, FONTWEIGHT_BOLD, FONTSLANT_ITALIC, FONTENCODING_DEFAULT)
title = FXLabel.new(frame, "Dashboard", nil, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
title.backColor = FXColor::White
title.setFont(@font_title)
title.justify = JUSTIFY_LEFT|JUSTIFY_CENTER_Y
@tabBook = FXTabBook.new(main, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
@tabBook.backColor = FXColor::White
tab = FXTabItem.new(@tabBook, "Project Information", nil)
@project_info_frame = ProjectInfo.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
tab = FXTabItem.new(@tabBook, "Scan Information", nil)
@scan_progress_frame = ScanProgressFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
@tabBook.connect(SEL_COMMAND) do |sender, sel, tabItem|
case tabItem.to_i
when 0
@project_info_frame.update()
when 1
when 2
end
end
start_update_timer
rescue => bang
puts "Error creating dashboard :("
puts bang
end
end
|
Instance Method Details
#module_finished(mod) ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'lib/watobo/gui/dashboard.rb', line 196
def module_finished(mod)
@progress_lock.synchronize do
begin
name = mod
name = mod.info[:check_name] if mod.respond_to? :run_checks
pbar = @scan_progress_frame.progress_bars[name]
pbar.finished
rescue => bang
puts bang
puts bang.backtrace if $DEBUG
end
end
end
|
#progress(m) ⇒ Object
212
213
214
215
216
217
218
219
|
# File 'lib/watobo/gui/dashboard.rb', line 212
def progress(m)
@progress_lock.synchronize do
name = m
name = m.info[:check_name] if m.respond_to? :run_checks
@scan_progress_frame.progress_bars[name].increment(1)
end
end
|
#progressDisplays ⇒ Object
192
193
194
|
# File 'lib/watobo/gui/dashboard.rb', line 192
def progressDisplays()
return @scan_progress_frame.progress_bars()
end
|
#setScanStatus(status) ⇒ Object
188
189
190
|
# File 'lib/watobo/gui/dashboard.rb', line 188
def setScanStatus(status)
@scan_progress_frame.scan_status.text = status
end
|
#setup_status_bars(frame, module_list) ⇒ Object
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
# File 'lib/watobo/gui/dashboard.rb', line 240
def setup_status_bars(frame, module_list)
module_list.each do |m|
dummy = FXVerticalFrame.new(frame, LAYOUT_FILL_X|FRAME_GROOVE)
dummy.create
label = "undefined"
begin
label = m.check_name
rescue => bang
end
l = FXLabel.new(dummy, label, :opts => LAYOUT_LEFT)
l.create
pbar = FXProgressBar.new(dummy, nil, 0, LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
pbar.create
pbar.progress = 0
pbar.total = @project.chats.length-1
pbar.barColor=0
pbar.barColor=FXRGB(255, 0, 0)
@module_list[m] = {
:progress => pbar,
}
end
end
|
#setupScanProgressFrame(scanner) ⇒ Object
181
182
183
184
185
186
|
# File 'lib/watobo/gui/dashboard.rb', line 181
def setupScanProgressFrame(scanner)
@progress_lock.synchronize do
@scanner = scanner
@scan_progress_frame.setup(scanner.progress)
end
end
|
#start_update_timer ⇒ Object
275
276
277
278
279
280
281
282
283
284
285
|
# File 'lib/watobo/gui/dashboard.rb', line 275
def start_update_timer
Watobo.save_thread {
unless @scanner.nil?
progress = @scanner.progress
progress.each do |m, info|
@scan_progress_frame.progress_bars[m].progress info[:progress]
end
end
}
end
|
#update_status(check_module, progress_index) ⇒ Object
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/watobo/gui/dashboard.rb', line 225
def update_status(check_module, progress_index)
if @module_list.has_key?(check_module) then
pbar = @module_list[check_module][:progress]
pbar.total = @project.chats.length-1
pbar.progress = progress_index
if progress_index == pbar.total
pbar.barColor=FXRGB(0, 255, 0)
end
else
puts "check_module not found in dashboard"
end
end
|
#updateProjectInfo ⇒ Object
221
222
223
|
# File 'lib/watobo/gui/dashboard.rb', line 221
def updateProjectInfo()
@project_info_frame.update()
end
|