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.
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
343
344
345
346
347
348
349
|
# File 'lib/watobo/gui/dashboard.rb', line 294
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/watobo/gui/dashboard.rb', line 203
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
219
220
221
222
223
224
225
226
|
# File 'lib/watobo/gui/dashboard.rb', line 219
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
199
200
201
|
# File 'lib/watobo/gui/dashboard.rb', line 199
def progressDisplays()
return @scan_progress_frame.progress_bars()
end
|
#setScanStatus(status) ⇒ Object
195
196
197
|
# File 'lib/watobo/gui/dashboard.rb', line 195
def setScanStatus(status)
@scan_progress_frame.scan_status.text = status
end
|
#setup_status_bars(frame, module_list) ⇒ Object
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
273
274
275
276
277
278
279
|
# File 'lib/watobo/gui/dashboard.rb', line 247
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
188
189
190
191
192
193
|
# File 'lib/watobo/gui/dashboard.rb', line 188
def setupScanProgressFrame(scanner)
@progress_lock.synchronize do
@scanner = scanner
@scan_progress_frame.setup(scanner.progress)
end
end
|
#start_update_timer ⇒ Object
282
283
284
285
286
287
288
289
290
291
292
|
# File 'lib/watobo/gui/dashboard.rb', line 282
def start_update_timer
@timer = FXApp.instance.addTimeout( 50, :repeat => true) {
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# File 'lib/watobo/gui/dashboard.rb', line 232
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
228
229
230
|
# File 'lib/watobo/gui/dashboard.rb', line 228
def updateProjectInfo()
@project_info_frame.update()
end
|