Class: Watobo::Gui::Dashboard

Inherits:
FXVerticalFrame
  • Object
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.


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
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/watobo/gui/dashboard.rb', line 306

def initialize(parent)
   begin

      super(parent, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN)
      #db_title = FXLabel.new(self, "DASHBOARD", :opts => LAYOUT_LEFT)
      @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)
      # tab.backColor = FXColor::White
      @project_info_frame = ProjectInfo.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
      # @project_info_frame.backColor = FXColor::White
      tab = FXTabItem.new(@tabBook, "Scan Information", nil)
      # tab.backColor = FXColor::White

      @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
            #  puts "Login Script Selected"
            @project_info_frame.update()
         when 1
            # puts "Session IDs Selected"

         when 2
            #
         end
      end
      
      start_update_timer

   rescue => bang
      puts "Error creating dashboard :("
      puts bang
   end
end

Instance Method Details

#module_finished(mod) ⇒ Object


215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/watobo/gui/dashboard.rb', line 215

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 
          #pbar.progress = pbar.total
          # pbar.barColor = 'green' # FXRGB(0,255,0)
      rescue => bang
         puts bang
         puts bang.backtrace if $DEBUG
      end
   end
end

#progress(m) ⇒ Object


231
232
233
234
235
236
237
238
# File 'lib/watobo/gui/dashboard.rb', line 231

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)
      # p @scan_progress_frame.progress_bars[name].total
   end
end

#progressDisplaysObject


211
212
213
# File 'lib/watobo/gui/dashboard.rb', line 211

def progressDisplays()
   return @scan_progress_frame.progress_bars()
end

#setScanStatus(status) ⇒ Object


207
208
209
# File 'lib/watobo/gui/dashboard.rb', line 207

def setScanStatus(status)
   @scan_progress_frame.scan_status.text = status
end

#setup_status_bars(frame, module_list) ⇒ Object


259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/watobo/gui/dashboard.rb', line 259

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
         #  puts "no check name defined"
         # puts bang
      end
      # puts "."
      l = FXLabel.new(dummy, label, :opts => LAYOUT_LEFT)
      l.create
      #   puts l
      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


200
201
202
203
204
205
# File 'lib/watobo/gui/dashboard.rb', line 200

def setupScanProgressFrame(scanner)
  @progress_lock.synchronize do
  @scanner = scanner
   @scan_progress_frame.setup(scanner.progress)
 end
end

#start_update_timerObject


294
295
296
297
298
299
300
301
302
303
304
# File 'lib/watobo/gui/dashboard.rb', line 294

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


244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/watobo/gui/dashboard.rb', line 244

def update_status(check_module, progress_index)
   if @module_list.has_key?(check_module) then
      #puts "updating status window"
      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

#updateProjectInfoObject


240
241
242
# File 'lib/watobo/gui/dashboard.rb', line 240

def updateProjectInfo()           
   @project_info_frame.update()
end