Class: Watobo::Gui::WwwAuthDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder, Icons
Defined in:
lib/watobo/gui/www_auth_dialog.rb

Constant Summary collapse

NO_SELECTION =
"no site selected"

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

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

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ WwwAuthDialog

Returns a new instance of WwwAuthDialog.


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
224
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
# File 'lib/watobo/gui/www_auth_dialog.rb', line 167

def initialize(owner)

  super(owner, "NTLM Authentication", :opts => DECOR_ALL)
  @project = Watobo.project
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)

     #   @password_policy = {
     #     :save_passwords => false
     #   }

#  @password_policy.update prefs[:password_policy] if prefs.has_key? :password_policy

  @site_dt = FXDataTarget.new('')
  @username_dt = FXDataTarget.new('')
  @domain_dt = FXDataTarget.new('')
  @password_dt = FXDataTarget.new('')
  @workstation_dt = FXDataTarget.new('')
  @auth_type_dt = FXDataTarget.new(AUTH_TYPE_NTLM)

  main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)

  top_frame = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_FILL_X)

#  @scope_only_cb = FXCheckButton.new(top_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
#  @scope_only_cb.setCheck(false)

#  if project.has_scope?
#  puts "project has scope defined"
#  end
 # @scope_only_cb.connect(SEL_COMMAND) { updateSitesCombo() }

  @sites_combo = FXComboBox.new(top_frame, 5,  @site_dt, FXDataTarget::ID_VALUE,
  COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  @sites_combo.numVisible = @sites_combo.numItems >= 20 ? 20 : @sites_combo.numItems
  @sites_combo.numColumns = 25
  @sites_combo.editable = true
  updateSitesCombo()

  FXLabel.new(top_frame, "User:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
  @username_txt = FXTextField.new(top_frame, 10,
  :target => @username_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)

  FXLabel.new(top_frame, "Password:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
  @password_txt = FXTextField.new(top_frame, 10,
  :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)

  FXLabel.new(top_frame, "Domain:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
  @domain_txt = FXTextField.new(top_frame, 10,
  :target => @domain_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)

  FXLabel.new(top_frame, "Workstation:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
  @workstation_txt = FXTextField.new(top_frame, 10,
  :target => @workstation_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)

  table_frame = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
  @auth_table = AuthTable.new(table_frame, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY)

  @auth_table.subscribe(:item_selected){ |selection|
    unless selection.nil? then
      @rem_auth_btn.enable
      selection.each_key do |k|
        settings = selection[k]
        @site_dt.value = k
        @sites_combo.setText(k)
        @username_dt.value = settings[:username]
        # @password_dt.value = settings[:password]
        @domain_dt.value = settings[:domain]
        @workstation_dt.value = settings[:workstation]
        updateFields()
      end
    else
    @rem_auth_btn.disable
    end
  }

  #pas = @project.getWwwAuthentication()
  pas = Watobo::Conf::Scanner.www_auth
  #   puts pas.to_yaml
  pas.each_key do |k|
    auth_settings = {
      :username => pas[k][:username],
      :password => pas[k][:password],
      :domain => pas[k][:domain],
      :workstation => pas[k][:workstation],
      :site => k,
      :type => pas[k][:type]
    }
    @auth_table.addAuthScope(auth_settings)
  end

  table_btn_frame = FXVerticalFrame.new(table_frame, :opts => LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
  @add_auth_btn = FXButton.new(table_btn_frame, "Add")
  @add_auth_btn.connect(SEL_COMMAND){ addAuthenticationItem() }
  #@add_auth_btn.disable

  @rem_auth_btn = FXButton.new(table_btn_frame, "Remove")
  @rem_auth_btn.connect(SEL_COMMAND){ remAuthenticationItem() }
  @rem_auth_btn.disable

#  frame = FXVerticalFrame.new(main_frame, :opts => LAYOUT_FILL_X)
#  @save_pws_cbt = FXCheckButton.new(frame, "save passwords")
#  @save_pws_cbt.checkState = false
#  @save_pws_cbt.checkState = true if @password_policy[:save_passwords] == true
#  note_label = FXLabel.new(frame, "This setting affects all passwords!!!")

  buttons = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
  :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)

  accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
  accept.enable
  # Cancel
  FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
end

Instance Method Details

#savePasswords?Boolean

Returns:

  • (Boolean)

160
161
162
163
# File 'lib/watobo/gui/www_auth_dialog.rb', line 160

def savePasswords?()
  return false
  #@save_pws_cbt.checked?
end