Class: Watobo::Gui::TokenScriptSettings

Inherits:
FXVerticalFrame
  • Object
show all
Defined in:
lib/watobo/gui/csrf_token_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(parent, target_chat) ⇒ TokenScriptSettings

Returns a new instance of TokenScriptSettings.


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
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 334

def initialize(parent, target_chat)
  @request = target_chat.request
  @table_filter = FXDataTarget.new('')
  @sel_row = -1
  super(parent, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)

  splitter = FXSplitter.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|SPLITTER_VERTICAL|LAYOUT_FILL_Y|SPLITTER_TRACKING)
  script_frame = FXVerticalFrame.new(splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE, :height => 300,:padding => 0)

  frame = FXHorizontalFrame.new(script_frame, :opts => LAYOUT_FILL_X)
  label = FXLabel.new(frame, "Token Script Requests:")
  @add_button = FXButton.new(frame, "Add Request...", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT)
  @add_button.connect(SEL_COMMAND, method(:startSelectChatDialog))

  @rem_button = FXButton.new(frame, "Remove Request", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT)
  @rem_button.connect(SEL_COMMAND, method(:removeRequest))
  @rem_button.disable

  label.setFont(FXFont.new(getApp(), "helvetica", 12, FONTWEIGHT_BOLD, FONTSLANT_ITALIC, FONTENCODING_DEFAULT))
  script_table_frame = FXVerticalFrame.new(script_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @scriptTable = ConversationTable.new(script_table_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  @scriptTable.connect(SEL_CLICKED, method(:onTableClick))

  chat_viewer_frame = FXVerticalFrame.new(splitter, LAYOUT_FILL_X|LAYOUT_FILL_Y, :height => 300, :padding => 0)
  tabBook = FXTabBook.new(chat_viewer_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT, :padding => 0)

  req_tab = FXTabItem.new(tabBook, "Request", nil)
  frame = FXVerticalFrame.new(tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
  @request_viewer = Watobo::Gui::SimpleTextView.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)

  resp_tab = FXTabItem.new(tabBook, "Response", nil)
  frame = FXVerticalFrame.new(tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
  @response_viewer = Watobo::Gui::SimpleTextView.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)

  if @request then
    Watobo.project.getCSRFRequestIDs(@request).each do |id|
      chat = Watobo::Chats.get_by_id(id)
      addRequest(chat)
    end
  end
end

Instance Method Details

#addRequest(chat) ⇒ Object


330
331
332
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 330

def addRequest(chat)
  @scriptTable.addChat(chat)
end

#getTokenScriptIdsObject


266
267
268
269
270
271
272
273
274
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 266

def getTokenScriptIds()
  ids = []
  @scriptTable.numRows.times do |row|
    # puts row
    ids.push @scriptTable.getRowText(row)
  end
  return ids

end

#onTableClick(sender, sel, item) ⇒ Object


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
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 276

def onTableClick(sender, sel, item)
  begin

    # purge viewers
    @request_viewer.setText('')
    @response_viewer.setText('')
    row = item.row

    if row >= 0 then
      @scriptTable.selectRow(row, false)
      chatid = @scriptTable.getRowText(item.row).to_i
      # @logText.appendText("selected ID: (#{chatid})\n")
      if chatid >= 0
        chat = Watobo::Chats.get_by_id(chatid)
        showChat(chat) if chat
        @sel_row = row
        @rem_button.enable
      end
    end
  rescue => bang
    puts "!!!ERROR: onTableClick"
    puts bang
    puts "!!!"

  end
end

#removeRequest(sender, sel, item) ⇒ Object


303
304
305
306
307
308
309
310
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 303

def removeRequest(sender, sel, item)
  if @sel_row >= 0 then
    @scriptTable.removeRows(@sel_row)
    @scriptTable.killSelection(false)
    @rem_button.disable
    @sel_row = -1
  end
end

#showChat(chat) ⇒ Object


259
260
261
262
263
264
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 259

def showChat(chat)
  @request_viewer.setText(chat.request)

  @response_viewer.setText(chat.response)

end

#startSelectChatDialog(sender, sel, item) ⇒ Object


312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/watobo/gui/csrf_token_dialog.rb', line 312

def startSelectChatDialog(sender, sel, item)
  begin
    dlg = Watobo::Gui::SelectChatDialog.new(self, "Select Login Chat")
    if dlg.execute != 0 then

      chats_selected = dlg.selection.value.split(",")

      chats_selected.each do |chatid|
        chat = Watobo::Chats.get_by_id(chatid.strip)
        addRequest(chat) if chat
      end
    end
  rescue => bang
    puts "!!!ERROR: could not open SelectChatDialog."
    puts bang
  end
end