Class: Watobo::Gui::PageTree

Inherits:
FXTreeList
  • Object
show all
Includes:
Icons
Defined in:
lib/watobo/gui/page_tree.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

Constants included from Constants

Constants::AC_GROUP_APACHE, Constants::AC_GROUP_DOMINO, Constants::AC_GROUP_ENUMERATION, Constants::AC_GROUP_FILE_INCLUSION, Constants::AC_GROUP_FLASH, Constants::AC_GROUP_GENERIC, Constants::AC_GROUP_JBOSS, Constants::AC_GROUP_JOOMLA, Constants::AC_GROUP_SAP, Constants::AC_GROUP_SQL, Constants::AC_GROUP_TYPO3, Constants::AC_GROUP_XSS, Constants::AUTH_TYPE_BASIC, Constants::AUTH_TYPE_DIGEST, Constants::AUTH_TYPE_NONE, Constants::AUTH_TYPE_NTLM, Constants::CHAT_SOURCE_AUTO_SCAN, Constants::CHAT_SOURCE_FUZZER, Constants::CHAT_SOURCE_INTERCEPT, Constants::CHAT_SOURCE_MANUAL, Constants::CHAT_SOURCE_MANUAL_SCAN, Constants::CHAT_SOURCE_PROXY, Constants::CHAT_SOURCE_UNDEF, Constants::DEFAULT_PORT_HTTP, Constants::DEFAULT_PORT_HTTPS, Constants::FINDING_TYPE_HINT, Constants::FINDING_TYPE_INFO, Constants::FINDING_TYPE_UNDEFINED, Constants::FINDING_TYPE_VULN, Constants::FIRST_TIME_FILE, Constants::GUI_REGULAR_FONT_SIZE, Constants::GUI_SMALL_FONT_SIZE, Constants::ICON_PATH, Constants::LOG_DEBUG, Constants::LOG_INFO, Constants::SCAN_CANCELED, Constants::SCAN_FINISHED, Constants::SCAN_PAUSED, Constants::SCAN_STARTED, Constants::TE_CHUNKED, Constants::TE_COMPRESS, Constants::TE_DEFLATE, Constants::TE_GZIP, Constants::TE_IDENTITY, Constants::TE_NONE, Constants::VULN_RATING_CRITICAL, Constants::VULN_RATING_HIGH, Constants::VULN_RATING_INFO, Constants::VULN_RATING_LOW, Constants::VULN_RATING_MEDIUM, Constants::VULN_RATING_UNDEFINED

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, page = nil, prefs = {}) ⇒ PageTree

Returns a new instance of PageTree.



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
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/watobo/gui/page_tree.rb', line 82

def initialize(parent, page=nil, prefs={})
  @page = page
  @quick_filter = Hash.new
  opts = LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT
  opts = prefs[:opts] if prefs.has_key? :opts
  super(parent, :opts => opts)
  @event_dispatcher_listeners = Hash.new
  @filters = {
    :element => []
  }

  forms = self.appendItem(nil, "load a new page first!", nil, nil)

  self.connect(SEL_COMMAND) do |sender, sel, item|
    
    if item.data.is_a? Mechanize::Form
         puts "Form Selected"
         notify(:form_selected, item.data)
    elsif item.data.is_a? Mechanize::Form::Field
      puts "Field Selected"
      notify(:form_selected, item.parent.data)
      notify(:field_selected, item)
    end

  end

  self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
    exclude_site = nil
    unless event.moved?
      FXMenuPane.new(self) do |menu_pane|

      #
        item = sender.getItemAt(event.win_x, event.win_y)

        unless item.nil?

          unless self.itemLeaf?(item)
            FXMenuSeparator.new(menu_pane)
            FXMenuCommand.new(menu_pane, "expand tree" ).connect(SEL_COMMAND) {
              expandFullTree(item)
            }

            FXMenuCommand.new(menu_pane, "collapse tree" ).connect(SEL_COMMAND) {
              self.collapseFullTree(item)
            }

          end

          data = self.getItemData(item)
          
          if item == "Forms" then
            puts "Right Click Forms"
            FXMenuSeparator.new(menu_pane)

            FXMenuCommand.new(menu_pane, "found Form Item" ).connect(SEL_COMMAND) {

              notify(:add_site_to_scope, item.to_s)
            }
          else
            puts "Didn't click Forms"

          end
        # submenu = FXMenuPane.new(self) do |domain_menu|

        #   @filtered_domains.each do |domain, filter|
        #     hide_domain = FXMenuCommand.new(domain_menu, "#{domain}" )
        #     hide_domain.connect(SEL_COMMAND) {
        #       @interface.default_settings[:domain_filters].delete(filter)
        #       @filtered_domains.clear
        #       @interface.updateTreeLists
        #     }
        #   end
        # end
        # FXMenuCascade.new(menu_pane, "Unhide Domains", nil, submenu)

        end
        menu_pane.create
        menu_pane.popup(nil, event.root_x, event.root_y)
        app.runModalWhileShown(menu_pane)

      end
    end
  end
end

Instance Attribute Details

#pageObject

Returns the value of attribute page.



29
30
31
# File 'lib/watobo/gui/page_tree.rb', line 29

def page
  @page
end

Instance Method Details

#collapseFullTree(item) ⇒ Object



69
70
71
72
73
74
# File 'lib/watobo/gui/page_tree.rb', line 69

def collapseFullTree(item)
  self.collapseTree(item)
  item.each do |c|
    collapseFullTree(c) if !self.itemLeaf?(c)
  end
end

#expandFullTree(item) ⇒ Object



62
63
64
65
66
67
# File 'lib/watobo/gui/page_tree.rb', line 62

def expandFullTree(item)
  self.expandTree(item)
  item.each do |c|
    expandFullTree(c) if !self.itemLeaf?(c)
  end
end

#hidden?(chat) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
79
80
# File 'lib/watobo/gui/page_tree.rb', line 76

def hidden?(chat)

  #TODO: Filter
  false
end

#refresh_treeObject



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/watobo/gui/page_tree.rb', line 48

def refresh_tree()
  self.clearItems
  unless @page.nil?
    if page.forms.length > 0
    page.forms.each do |f|
      add_form_item f
    end
    else
      self.appendItem(nil, "Forms ()", nil, nil)
    end
  end
# @interface.updateRequestTable(@project)
end

#reloadObject



37
38
39
40
41
# File 'lib/watobo/gui/page_tree.rb', line 37

def reload()
  self.clearItems

# @interface.updateRequestTable(@project)
end

#subscribe(event, &callback) ⇒ Object



33
34
35
# File 'lib/watobo/gui/page_tree.rb', line 33

def subscribe(event, &callback)
  (@event_dispatcher_listeners[event] ||= []) << callback
end