Class: Watobo::Gui::AuthTable

Inherits:
FXTable
  • Object
show all
Defined in:
lib/watobo/gui/www_auth_dialog.rb

Constant Summary

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 Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ AuthTable

Returns a new instance of AuthTable.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/watobo/gui/www_auth_dialog.rb', line 97

def initialize(owner, opts)
  super(owner, opts)
  @event_dispatcher_listeners = Hash.new
  initTable()

  self.connect(SEL_COMMAND) { |sender, sel, item|
    cr = self.currentRow
    if cr >= 0 then
    www_auth = Hash.new
    www_auth_scope = Hash.new
    site = self.getItemText(cr, 0)
    www_auth[site] = www_auth_scope
    www_auth_scope[:username] = self.getItemText(cr, 2)
    www_auth_scope[:password] = self.getItemData(cr, 3)
    www_auth_scope[:type] = self.getItemData(cr, 1)
    www_auth_scope[:domain] = self.getItemText(cr, 4)
    www_auth_scope[:workstation] = self.getItemText(cr, 5)
    notify(:item_selected, www_auth)
    else
    notify(:item_selected, nil)
    end
  }

end

Instance Method Details

#addAuthScope(www_auth = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/watobo/gui/www_auth_dialog.rb', line 53

def addAuthScope(www_auth = {})
  return nil if www_auth[:username].nil? or www_auth[:password].nil?
  siteIndex = -1
  lastRowIndex = self.getNumRows
  lastRowIndex.times do |i|
    if self.getItemText(i, 0) == www_auth[:site] then
    siteIndex = i
    lastRowIndex = i
    break
    end
  end
  self.appendRows(1) if siteIndex < 0

  table_items = [ :site, :type, :username, :password, :domain, :workstation ]

  # puts table_items[i]
  self.setItemText(lastRowIndex, 0, www_auth[:site] )
  self.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT

  text = case www_auth[:type]
  when AUTH_TYPE_NTLM
    "NTLM"
  end

  self.setItemText(lastRowIndex, 1,  text)
  self.setItemData(lastRowIndex, 1, www_auth[:type])
  self.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT

  self.setItemText(lastRowIndex, 2, www_auth[:username] )
  self.getItem(lastRowIndex, 2).justify = FXTableItem::LEFT

  pw_text = www_auth[:password] == "" ? "- not set -" : "********"
  self.setItemText(lastRowIndex, 3, pw_text )
  self.setItemData(lastRowIndex, 3, www_auth[:password] )
  self.getItem(lastRowIndex, 3).justify = FXTableItem::LEFT

  self.setItemText(lastRowIndex, 4, www_auth[:domain] )
  self.getItem(lastRowIndex, 4).justify = FXTableItem::LEFT

  self.setItemText(lastRowIndex, 5, www_auth[:workstation] )
  self.getItem(lastRowIndex, 5).justify = FXTableItem::LEFT

end

#delCurrentRowObject



46
47
48
49
50
51
# File 'lib/watobo/gui/www_auth_dialog.rb', line 46

def delCurrentRow()
  cr = self.currentRow
  self.removeRows(cr, 1, true) if cr >= 0
  self.killSelection()
  notify(:item_selected, nil)
end

#settingsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/watobo/gui/www_auth_dialog.rb', line 31

def settings
  www_auth = {}
  self.numRows.times do |i|
    www_auth_scope = Hash.new
    site = self.getItemText(i, 0)
    www_auth[site] = www_auth_scope
    www_auth_scope[:username] = self.getItemText(i, 2)
    www_auth_scope[:password] = self.getItemData(i, 3)
    www_auth_scope[:type] = self.getItemData(i, 1)
    www_auth_scope[:domain] = self.getItemText(i, 4)
    www_auth_scope[:workstation] = self.getItemText(i, 5)
  end
  www_auth
end

#subscribe(event, &callback) ⇒ Object



27
28
29
# File 'lib/watobo/gui/www_auth_dialog.rb', line 27

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