Class: Watobo::Gui::StatisticsFrame
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::StatisticsFrame
- Defined in:
- lib/watobo/gui/fuzzer_gui.rb
Instance Method Summary collapse
- #addResponse(response) ⇒ Object
- #clearResponseCodeTable ⇒ Object
- #clearResponseLengthTable ⇒ Object
- #clearView ⇒ Object
-
#initialize(parent, opts) ⇒ StatisticsFrame
constructor
A new instance of StatisticsFrame.
Constructor Details
#initialize(parent, opts) ⇒ StatisticsFrame
Returns a new instance of StatisticsFrame.
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/watobo/gui/fuzzer_gui.rb', line 435 def initialize(parent, opts) super(parent, opts) @lock = Mutex.new @count_total = 0 counter_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) response_code_gb = FXGroupBox.new(counter_frame, "Response Codes", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0) frame = FXVerticalFrame.new(response_code_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y ) sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0) @response_code_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2) @response_code_tbl.columnHeader.connect(SEL_COMMAND) { } clearResponseCodeTable() response_length_gb = FXGroupBox.new(counter_frame, "Response Length", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_Y, 0, 0, 0, 0) frame = FXVerticalFrame.new(response_length_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y ) sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0) @response_length_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2) @response_length_tbl.columnHeader.connect(SEL_COMMAND) { } clearResponseLengthTable() end |
Instance Method Details
#addResponse(response) ⇒ Object
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/watobo/gui/fuzzer_gui.rb', line 373 def addResponse(response) return nil unless response.respond_to? :status @lock.synchronize { cstatus = response.status count_item = nil @response_code_tbl.getNumRows.times do |i| rc_item = @response_code_tbl.getItem(i, 0) count_item = @response_code_tbl.getItem(i, 1) if rc_item.text == response.status break unless count_item.nil? end if count_item.nil? lastRowIndex = @response_code_tbl.getNumRows @response_code_tbl.appendRows(1) @response_code_tbl.setItemText(lastRowIndex, 0, cstatus) @response_code_tbl.setItemText(lastRowIndex, 1, "1") count_item = @response_code_tbl.getItem(lastRowIndex, 1) else c = count_item.text.to_i count_item.text = ( c + 1 ).to_s end } end |
#clearResponseCodeTable ⇒ Object
400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/watobo/gui/fuzzer_gui.rb', line 400 def clearResponseCodeTable() @response_code_tbl.clearItems() @response_code_tbl.setTableSize(0, 2) @response_code_tbl.setColumnText( 0, "STATUS" ) @response_code_tbl.setColumnText( 1, "COUNT" ) @response_code_tbl.rowHeader.width = 0 @response_code_tbl.setColumnWidth(0, 70) @response_code_tbl.setColumnWidth(1, 70) end |
#clearResponseLengthTable ⇒ Object
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/watobo/gui/fuzzer_gui.rb', line 415 def clearResponseLengthTable() @response_length_tbl.clearItems() @response_length_tbl.setTableSize(0, 2) @response_length_tbl.columnHeader.height = 0 @response_length_tbl.rowHeader.width = 0 @response_length_tbl.setColumnWidth(0, 40) @response_length_tbl.setColumnWidth(1, 40) lastRowIndex = @response_length_tbl.getNumRows %w( MIN MAX AVRG ).each do |i| lastRowIndex = @response_length_tbl.getNumRows @response_length_tbl.appendRows(1) @response_length_tbl.setItemText(lastRowIndex, 0, i) @response_length_tbl.setItemText(lastRowIndex, 1, "0") @response_length_tbl.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT @response_length_tbl.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT end end |
#clearView ⇒ Object
367 368 369 370 371 |
# File 'lib/watobo/gui/fuzzer_gui.rb', line 367 def clearView() @count_total = 0 clearResponseCodeTable() clearResponseLengthTable() end |