Class: Watobo::Gui::ScopeDetailsFrame
- Inherits:
-
FXVerticalFrame
- Object
- FXVerticalFrame
- Watobo::Gui::ScopeDetailsFrame
- Defined in:
- lib/watobo/gui/define_scope_frame.rb
Instance Method Summary collapse
- #addPattern(list_box, pattern) ⇒ Object
-
#getDetails ⇒ Object
def fxMessageBox() FXMessageBox.information(self, MBOX_OK, “Wrong Signature Format”, “Signature Format is wrong. Must be a valid regular expression, e.g.(<Regex>) <^Location.*action=logout>”) end.
-
#initialize(parent, details = nil) ⇒ ScopeDetailsFrame
constructor
A new instance of ScopeDetailsFrame.
- #removePattern(list_box, pattern) ⇒ Object
- #updateFrame(details) ⇒ Object
Constructor Details
#initialize(parent, details = nil) ⇒ ScopeDetailsFrame
Returns a new instance of ScopeDetailsFrame.
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 |
# File 'lib/watobo/gui/define_scope_frame.rb', line 77 def initialize(parent, details=nil) @rootpath_dt = FXDataTarget.new('') @expath_dt = FXDataTarget.new('') super(parent, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) # main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X|FRAME_NONE, :padding => 0) title_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|FRAME_GROOVE) title = FXLabel.new(title_frame, "Site:", :opts => LAYOUT_TOP) title = FXLabel.new(title_frame, "#{details[:site]}") title.setFont(FXFont.new(getApp(), "helvetica", 12, FONTWEIGHT_BOLD, FONTSLANT_ITALIC, FONTENCODING_DEFAULT)) # # ROOT PATH BOX gbframe = FXGroupBox.new(self, "Root Path", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0) frame = FXVerticalFrame.new(gbframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0) #text_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding =>0) fxtext = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP) fxtext.backColor = fxtext.parent.backColor fxtext.disable text = "The Root Path defines the application root of the site. " + "Only URLs which include the Root Path will be tested during a scan." + "\nSetting the Root Path to 'myapp', only URLs that begin with http://#{details[:site]}/myapp/ will be tested." fxtext.setText(text) input_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X|FRAME_NONE) FXLabel.new(input_frame,"Root Path (RegEx):") @rootpath_field = FXTextField.new(input_frame, 0, :target => @rootpath_dt, :selector => FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT) # # EXCLUDED gbframe = FXGroupBox.new(self, "Excluded Path's", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0) frame = FXVerticalFrame.new(gbframe, :opts => LAYOUT_FILL_X, :padding => 0) fxtext = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP) fxtext.backColor = fxtext.parent.backColor fxtext.disable text = "URLs which match a pattern will not be tested during a scan." fxtext.setText(text) input_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X) @expath_field = FXTextField.new(input_frame, 20, :target => @expath_dt, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT|LAYOUT_FILL_X) @remExPath = FXButton.new(input_frame, "Remove" , :opts => BUTTON_NORMAL|LAYOUT_RIGHT) @addExPath = FXButton.new(input_frame, "Add" , :opts => BUTTON_NORMAL|LAYOUT_RIGHT) list_frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|FRAME_SUNKEN, :padding => 0) @expath_list = FXList.new(list_frame, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y) @expath_list.numVisible = 5 @expath_list.connect(SEL_COMMAND){ |sender, sel, item| @expath_dt.value = sender.getItemText(item) @expath_field.handle(self, FXSEL(SEL_UPDATE, 0), nil) } @remExPath.connect(SEL_COMMAND){ |sender, sel, item| removePattern(@expath_list, @expath_dt.value) if @expath_dt.value != '' @expath_dt.value = '' @expath_field.handle(self, FXSEL(SEL_UPDATE, 0), nil) } @addExPath.connect(SEL_COMMAND){ |sender, sel, item| addPattern(@expath_list, @expath_dt.value) if @expath_dt.value != '' @expath_dt.value = '' @expath_field.handle(self, FXSEL(SEL_UPDATE, 0), nil) } @expath_dt.connect(SEL_COMMAND){ |sender, sel, item| addPattern(@expath_list, @expath_dt.value) if @expath_dt.value != '' @expath_dt.value = '' @expath_field.handle(self, FXSEL(SEL_UPDATE, 0), nil) } updateFrame(details) self.update end |
Instance Method Details
#addPattern(list_box, pattern) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/watobo/gui/define_scope_frame.rb', line 55 def addPattern(list_box, pattern) if pattern != "" then pattern_ok, *error = Watobo::Utils.checkRegex(pattern) if pattern_ok == true item = list_box.appendItem("#{pattern}") list_box.setItemData(item, pattern) list_box.sortItems() else FXMessageBox.information(self, MBOX_OK, "Wrong Path Format", "Path must be a Regex!!!\nError: #{error.join('\n')}") end end end |
#getDetails ⇒ Object
def fxMessageBox()
FXMessageBox.information(self, MBOX_OK, "Wrong Signature Format", "Signature Format is wrong. Must be a valid regular expression, e.g.(<Regex>) <^Location.*action=logout>")
end
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/watobo/gui/define_scope_frame.rb', line 37 def getDetails d = Hash.new d[:root_path] = @rootpath_dt.value path_array = [] @expath_list.each do |p| path_array.push p.data end d[:excluded_paths] = path_array d end |
#removePattern(list_box, pattern) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/watobo/gui/define_scope_frame.rb', line 48 def removePattern(list_box, pattern) index = list_box.currentItem if index >= 0 list_box.removeItem(index) end end |
#updateFrame(details) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/watobo/gui/define_scope_frame.rb', line 69 def updateFrame(details) @rootpath_dt.value = details[:root_path] @rootpath_field.handle(self, FXSEL(SEL_UPDATE, 0), nil) details[:excluded_paths].each do |p| addPattern(@expath_list, p) end end |