Class: Watobo::Gui::FindingsTree
- Inherits:
-
FXTreeList
- Object
- FXTreeList
- Watobo::Gui::FindingsTree
- Includes:
- Icons
- Defined in:
- lib/watobo/gui/findings_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
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #addFinding(finding) ⇒ Object
- #addFindingItem(finding) ⇒ Object
- #collapseFullTree(item) ⇒ Object
- #expandFullTree(item) ⇒ Object
- #hidden?(finding) ⇒ Boolean
- #hideDomain(domain_filter) ⇒ Object
-
#initialize(parent, interface, project) ⇒ FindingsTree
constructor
A new instance of FindingsTree.
- #reload ⇒ Object
- #subscribe(event, &callback) ⇒ Object
- #useRegularIcons ⇒ Object
- #useSmallIcons ⇒ Object
Constructor Details
#initialize(parent, interface, project) ⇒ FindingsTree
Returns a new instance of FindingsTree.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 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 280 281 282 283 284 285 286 287 288 289 290 291 292 293 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 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 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 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/watobo/gui/findings_tree.rb', line 225 def initialize(parent, interface, project) @project = project @interface = interface @parent = parent @findings = Hash.new @show_scope_only = false @hide_false_positives = false @clipboard = "" @expandeds = [] @event_dispatcher_listeners = Hash.new super(parent, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT) useRegularIcons() @filtered_domains = Hash.new # domains which already have been filtered self.connect(SEL_CLIPBOARD_REQUEST) do setDNDData(FROM_CLIPBOARD, FXWindow.stringType, Fox.fxencodeStringData(@clipboard.to_s)) end self.connect(SEL_EXPANDED) do |sender, sel, item| parent = item while parent.parent parent = parent.parent end unless parent.nil? or item.nil? node = "#{parent.text}|#{item.text}" @expandeds << node end end self.connect(SEL_COLLAPSED) do |sender, sel, item| parent = item while parent.parent parent = parent.parent end node = "#{parent.text}|#{item.text}" @expandeds.delete node end self.connect(SEL_COMMAND) do |sender, sel, item| if self.itemLeaf?(item) getApp().beginWaitCursor do begin if item.data if item.data.is_a? Watobo::Finding #@interface.show_vuln(item.data) notify(:vuln_click, item.data) end end rescue => bang puts "!!! Error: could not show selected finding" puts bang end end elsif item.data == :title then #@interface.show_vuln(item.first.data) if item.first.data notify(:vuln_click, (item.first.data)) if item.first.data end end self.connect(SEL_DOUBLECLICKED) do |sender, sel, item| if self.itemLeaf?(item) begin puts item.data.class if item.data.is_a? Watobo::Finding #TODO: show vulnerability details # @interface.showFindingInfo(item.data) notify(:finding_click, item.data) else puts item.data.class.to_s end rescue => bang puts "!!! Error: could not show selected finding" puts bang end end end self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event| unless event.moved? FXMenuPane.new(self) do || item = sender.getItemAt(event.win_x, event.win_y) unless item.nil? data = self.getItemData(item) unless self.itemLeaf?(item) FXMenuCommand.new(, "expand tree" ).connect(SEL_COMMAND) { (item) } FXMenuCommand.new(, "collapse tree" ).connect(SEL_COMMAND) { self.collapseFullTree(item) } FXMenuSeparator.new() end end target = FXMenuCheck.new(, "show scope only" ) target.check = @show_scope_only target.connect(SEL_COMMAND) { |ts, sl, it| @show_scope_only = ts.checked? reload } target = FXMenuCheck.new(, "hide false-positives" ) target.check = @hide_false_positives target.connect(SEL_COMMAND) { |ts, sl, it| @hide_false_positives = ts.checked? reload } unless item.nil? data = self.getItemData(item) FXMenuSeparator.new() unless data == :finding_type if data == :item_type_site then # FXMenuSeparator.new(menu_pane) FXMenuCommand.new(, "add site to scope" ).connect(SEL_COMMAND) { #notify(:add_site_to_scope, item.to_s) Watobo::Scope.add item.to_s reload } # elsif data == :title findings = [] item.each do |ft| f = self.getItemData(ft) findings << f if f.is_a? Watobo::Finding end = FXMenuPane.new(self) do |sub| target = FXMenuCommand.new(sub, "Set False Positive" ) target.connect(SEL_COMMAND) { # puts "* False Positive #{findings.length}" # remember parent node to expand it later fclass = item.parent.text fcat = item.parent.parent.text fsite = item.parent.parent.parent.text puts ">> #{fsite} - #{fcat} - #{fclass} (#{fclass.object_id})" notify(:set_false_positive, findings) reload site_item = cat_item = class_item = nil site_item = self.findItem(fsite, nil,SEARCH_FORWARD|SEARCH_IGNORECASE) unless site_item.nil? self.(site_item) cat_item = self.findItem(fcat, site_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless cat_item.nil? self.(cat_item) class_item = self.findItem(fclass, cat_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless class_item.nil? puts "Expanding #{class_item} (#{class_item.object_id})-> #{cat_item} -> #{site_item}" self.(class_item) else puts "Could not find tree item for #{class_item} (#{class_item.object_id})-> #{cat_item} -> #{site_item}" end } target = FXMenuCommand.new(sub, "Unset False Positive" ) target.connect(SEL_COMMAND) { fclass = item.parent.text fcat = item.parent.parent.text fsite = item.parent.parent.parent.text notify(:unset_false_positive, findings) reload site_item = cat_item = class_item = nil site_item = self.findItem(fsite, nil,SEARCH_FORWARD|SEARCH_IGNORECASE) unless site_item.nil? self.(site_item) cat_item = self.findItem(fcat, site_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless cat_item.nil? self.(cat_item) class_item = self.findItem(fclass, cat_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless class_item.nil? puts "Expanding #{class_item} (#{class_item.object_id})-> #{cat_item} -> #{site_item}" self.(class_item) else puts "Could not find tree item for #{class_item} (#{class_item.object_id})-> #{cat_item} -> #{site_item}" end } FXMenuSeparator.new(sub) FXMenuCommand.new(sub, "Purge - NO UNDO!" ).connect(SEL_COMMAND) { notify(:purge_findings, findings) reload } end FXMenuCascade.new(, "All \"#{item}\"", nil, ) FXMenuSeparator.new() info = FXMenuCommand.new(, "Details..." ) info.connect(SEL_COMMAND) { #@interface.showFindingDetails(item.data)} notify(:show_finding_details, findings.first) } elsif data == :finding_class #puts "FINDING_CLASS" # COPY SUBMENU findings = [] item.each do |c| c.each do |ft| f = self.getItemData(ft) findings << f if f.is_a? Watobo::Finding end end = FXMenuPane.new(self) do |sub| target = FXMenuCommand.new(sub, "Copy URLs" ) target.connect(SEL_COMMAND) { urls = [] findings.each do |f| proto = f.request.proto site = f.request.site path = f.request.path urls << "#{proto}://#{site}/#{path}" end types = [ FXWindow.stringType ] if acquireClipboard(types) @clipboard = urls.uniq.join("\n") end } target = FXMenuCommand.new(sub, "Set False Positive" ) target.connect(SEL_COMMAND) { fcat = item.parent.text fsite = item.parent.parent.text notify(:set_false_positive, findings) reload site_item = cat_item = class_item = nil site_item = self.findItem(fsite, nil,SEARCH_FORWARD|SEARCH_IGNORECASE) unless site_item.nil? self.(site_item) cat_item = self.findItem(fcat, site_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless cat_item.nil? self.(cat_item) end } target = FXMenuCommand.new(sub, "Unset False Positive" ) target.connect(SEL_COMMAND) { fcat = item.parent.text fsite = item.parent.parent.text notify(:unset_false_positive, findings) reload site_item = cat_item = class_item = nil site_item = self.findItem(fsite, nil,SEARCH_FORWARD|SEARCH_IGNORECASE) unless site_item.nil? self.(site_item) cat_item = self.findItem(fcat, site_item,SEARCH_FORWARD|SEARCH_IGNORECASE) end unless cat_item.nil? self.(cat_item) end } FXMenuSeparator.new(sub) FXMenuCommand.new(sub, "Purge - NO UNDO!" ).connect(SEL_COMMAND) { puts "* purge findings #{findings.length}" notify(:purge_findings, findings) reload } end FXMenuCascade.new(, "All \"#{item}\"", nil, ) FXMenuSeparator.new() info = FXMenuCommand.new(, "Details..." ) info.connect(SEL_COMMAND) { #@interface.showFindingDetails(item.data)} notify(:show_finding_details, findings.first) } elsif data.is_a? Watobo::Finding then FXMenuCommand.new(, "Copy URL" ).connect(SEL_COMMAND){ types = [ FXWindow.stringType ] if acquireClipboard(types) @clipboard = item.data.request.url.to_s end } # FXMenuSeparator.new(menu_pane) doManual = FXMenuCommand.new(, "Manual Request.." ) doManual.connect(SEL_COMMAND) { # @interface.open_manual_request_editor(item.data) notify(:open_manual_request, item.data) } info = FXMenuCommand.new(, "Details..." ) info.connect(SEL_COMMAND) { #@interface.showFindingDetails(item.data)} notify(:show_finding_details, item.data) } end end .create .popup(nil, event.root_x, event.root_y) app.runModalWhileShown() end end end end |
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
29 30 31 |
# File 'lib/watobo/gui/findings_tree.rb', line 29 def project @project end |
Instance Method Details
#addFinding(finding) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/watobo/gui/findings_tree.rb', line 120 def addFinding(finding) # p "* add finding to tree" # puts finding.details[:title] @findings[finding.details[:fid]] = finding if @show_scope_only == true addFindingItem(finding) if Watobo::Scope.match_site?(finding.request.site) else addFindingItem(finding) end end |
#addFindingItem(finding) ⇒ Object
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/watobo/gui/findings_tree.rb', line 132 def addFindingItem(finding) begin site = nil # puts "add finding" if not hidden?(finding) then site = self.findItem(finding.request.site, nil,SEARCH_FORWARD|SEARCH_IGNORECASE) if not site then # found new site site = self.appendItem(nil, finding.request.site, @icon_project, @icon_project) item = self.appendItem(site, "Vulnerabilities", @icon_vuln, @icon_vuln) self.setItemData(item, :finding_type ) item = self.appendItem(site, "Hints", @icon_hints, @icon_hints) self.setItemData(item, :finding_type ) item = self.appendItem(site, "Info", @icon_info, @icon_info) self.setItemData(item, :finding_type ) #site = @findings_tree.moveItem(project.first,project,site) self.setItemData(site, :item_type_site) end finding_type="" case finding.details[:type] when FINDING_TYPE_INFO finding_type = "Info" icon = @icon_info_info when FINDING_TYPE_HINT finding_type = "Hints" icon = @icon_hints_info when FINDING_TYPE_VULN finding_type = "Vulnerabilities" icon = @icon_vuln_bp if finding.details[:rating] == VULN_RATING_LOW icon = @icon_vuln_low # puts "low-rating-vuln" end if finding.details[:rating] == VULN_RATING_MEDIUM icon = @icon_vuln_medium end if finding.details[:rating] == VULN_RATING_HIGH icon = @icon_vuln_high end if finding.details[:rating] == VULN_RATING_CRITICAL icon = @icon_vuln_critical end end sub_tree = self.findItem(finding_type, site, SEARCH_FORWARD|SEARCH_IGNORECASE|SEARCH_NOWRAP) if sub_tree and sub_tree.parent == site and finding.details[:class] class_item = self.findItem(finding.details[:class], sub_tree, SEARCH_FORWARD|SEARCH_IGNORECASE|SEARCH_NOWRAP|SEARCH_PREFIX) if not class_item or class_item.parent != sub_tree class_item = self.appendItem(sub_tree, finding.details[:class], icon, icon) self.setItemData(class_item, :finding_class ) end title_item = self.findItem(finding.details[:title], class_item, SEARCH_FORWARD|SEARCH_IGNORECASE|SEARCH_NOWRAP) if not title_item or title_item.parent != class_item title_item = self.appendItem(class_item, finding.details[:title], nil, nil) self.setItemData(title_item, :title ) # puts finding.details[:title] end # puts title_item resource = finding.request.path_ext request_item = self.findItem(resource, title_item, SEARCH_FORWARD|SEARCH_IGNORECASE|SEARCH_NOWRAP) if not request_item or request_item.parent != title_item text = "/" + resource request_item = self.appendItem(title_item, text) self.setItemData(request_item, finding) end # unless class_item.text =~ / \(\d+\)$/ class_item.text = class_item.text + " (#{class_item.numChildren})" else class_item.text = class_item.text.gsub(/ \(\d+\)$/, " (#{class_item.numChildren})") end end end rescue => bang puts "!ERROR: could not add finding to tree" puts bang puts bang.backtrace if $DEBUG end end |
#collapseFullTree(item) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/watobo/gui/findings_tree.rb', line 42 def collapseFullTree(item) @expandeds = [] self.collapseTree(item) item.each do |c| collapseFullTree(c) if !self.itemLeaf?(c) end end |
#expandFullTree(item) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/watobo/gui/findings_tree.rb', line 34 def (item) @expandeds = [] self.(item) item.each do |c| (c) if !self.itemLeaf?(c) end end |
#hidden?(finding) ⇒ Boolean
50 51 52 53 |
# File 'lib/watobo/gui/findings_tree.rb', line 50 def hidden?(finding) return true if @hide_false_positives == true and finding.false_positive? false end |
#hideDomain(domain_filter) ⇒ Object
114 115 116 117 118 |
# File 'lib/watobo/gui/findings_tree.rb', line 114 def hideDomain(domain_filter) #@interface.default_settings[:domain_filters].push domain_filter #@interface.updateTreeLists #notify(:new_domain_filter, domain_filter) end |
#reload ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/watobo/gui/findings_tree.rb', line 56 def reload() self.clearItems @findings.clear Watobo::Findings.each do |fid, finding| addFinding(finding) end @expandeds.each do |t| site, text = t.split("|") if( site = self.findItem(site, nil, SEARCH_FORWARD|SEARCH_NOWRAP) ) if( node = self.findItem(text, site, SEARCH_FORWARD|SEARCH_NOWRAP) ) self.(node) else @expandeds.delete t end end end end |
#subscribe(event, &callback) ⇒ Object
30 31 32 |
# File 'lib/watobo/gui/findings_tree.rb', line 30 def subscribe(event, &callback) (@event_dispatcher_listeners[event] ||= []) << callback end |
#useRegularIcons ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/watobo/gui/findings_tree.rb', line 75 def useRegularIcons() regular_font = FXFont.new(getApp(), "helvetica", GUI_REGULAR_FONT_SIZE) regular_font.create # Findings Tree Icons @icon_vuln = ICON_VULN @icon_vuln_bp = ICON_VULN_BP @icon_vuln_low = ICON_VULN_LOW @icon_vuln_medium = ICON_VULN_MEDIUM @icon_vuln_high = ICON_VULN_HIGH @icon_vuln_critical = ICON_VULN_CRITICAL @icon_info = ICON_INFO @icon_info_info = ICON_INFO_INFO @icon_hints_info = ICON_INFO_INFO @icon_project = ICON_PROJECT @icon_hints = ICON_HINTS self.font = regular_font reload() end |
#useSmallIcons ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/watobo/gui/findings_tree.rb', line 96 def useSmallIcons small_font = FXFont.new(getApp(), "helvetica", GUI_SMALL_FONT_SIZE) small_font.create @icon_vuln = ICON_VULN_SMALL @icon_vuln_bp = ICON_VULN_BP_SMALL @icon_vuln_low = ICON_VULN_LOW_SMALL @icon_vuln_medium = ICON_VULN_MEDIUM_SMALL @icon_vuln_high = ICON_VULN_HIGH_SMALL @icon_vuln_critical = ICON_VULN_CRITICAL_SMALL @icon_info = ICON_INFO_SMALL @icon_info_info = ICON_INFO_INFO_SMALL @icon_hints_info = ICON_INFO_INFO_SMALL @icon_project = ICON_PROJECT_SMALL @icon_hints = ICON_HINTS_SMALL self.font = small_font reload() end |