Class: Buby::MessageEditorTab Abstract

Inherits:
Object
  • Object
show all
Includes:
Java::Burp::IMessageEditorTab, Java::Burp::IMessageEditorTabFactory
Defined in:
lib/buby/message_editor_tab.rb

Overview

This class is abstract.
TODO:

voodoo method wrapping

Extensions that register an IMessageEditorTabFactory must return instances of this interface, which Burp will use to create custom tabs within its HTTP message editors.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, editable) ⇒ IMessageEditorTab

This method is abstract.

subclass and call super

Burp will call this method once for each HTTP message editor, and the factory should provide a new instance of an IMessageEditorTab object.

Parameters:

  • controller (IMessageEditorController)

    An object which the new tab can query to retrieve details about the currently displayed message. This may be nil for extension-invoked message editors where the extension has not provided an editor controller.

  • editable (Boolean)

    Indicates whether the hosting editor is editable or read-only.



14
15
16
17
# File 'lib/buby/message_editor_tab.rb', line 14

def initialize controller, editable
  @controller = controller
  @editable = editable
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



12
13
14
# File 'lib/buby/message_editor_tab.rb', line 12

def controller
  @controller
end

#editableObject

Returns the value of attribute editable.



12
13
14
# File 'lib/buby/message_editor_tab.rb', line 12

def editable
  @editable
end

Class Method Details

.createNewInstance(controller, editable) ⇒ IMessageEditorTab

This method is abstract.

subclass and call super

Burp will call this method once for each HTTP message editor, and the factory should provide a new instance of an IMessageEditorTab object.

Parameters:

  • controller (IMessageEditorController)

    An object which the new tab can query to retrieve details about the currently displayed message. This may be nil for extension-invoked message editors where the extension has not provided an editor controller.

  • editable (Boolean)

    Indicates whether the hosting editor is editable or read-only.

Returns:

  • (IMessageEditorTab)

    A new tab for use within the message editor.



20
21
22
# File 'lib/buby/message_editor_tab.rb', line 20

def self.createNewInstance controller, editable
  self.new controller, editable
end

Instance Method Details

#getMessageArray<byte>

This method returns the currently displayed message.

Returns:

  • (Array<byte>)

    The currently displayed message.

Raises:

  • (NotImplementedError)


78
# File 'lib/buby/message_editor_tab.rb', line 78

def getMessage; raise NotImplementedError; end

#getSelectedDataArray<byte>

This method is used to retrieve the data that is currently selected by the user.

Returns:

  • (Array<byte>)

    The data that is currently selected by the user. This may be nil if no selection is currently made.

Raises:

  • (NotImplementedError)


96
# File 'lib/buby/message_editor_tab.rb', line 96

def getSelectedData; raise NotImplementedError; end

#getTabCaptionString

Note:

Burp invokes this method once when the tab is first generated, and the same caption will be used every time the tab is displayed.

This method returns the caption that should appear on the custom tab when it is displayed.

Returns:

  • (String)

    The caption that should appear on the custom tab when it is displayed.



32
# File 'lib/buby/message_editor_tab.rb', line 32

def getTabCaption; self.class.name; end

#getUiComponentObject

Note:

Burp invokes this method once when the tab is first generated, and the same component will be used every time the tab is displayed.

This method returns the component that should be used as the contents of the custom tab when it is displayed.

Returns:

  • The component that should be used as the contents of the custom tab when it is displayed.

Raises:

  • (NotImplementedError)


42
# File 'lib/buby/message_editor_tab.rb', line 42

def getUiComponent; raise NotImplementedError; end

#isEnabled(content, isRequest) ⇒ Boolean

The hosting editor will invoke this method before it displays a new HTTP message, so that the custom tab can indicate whether it should be enabled for that message.

Parameters:

  • content (Array<byte>)

    The message that is about to be displayed.

  • isRequest (Boolean)

    Indicates whether the message is a request or a response.

Returns:

  • (Boolean)

    The method should return true if the custom tab is able to handle the specified message, and so will be displayed within the editor. Otherwise, the tab will be hidden while this message is displayed.

Raises:

  • (NotImplementedError)


56
57
58
59
# File 'lib/buby/message_editor_tab.rb', line 56

def isEnabled(content, isRequest)
  content = String.from_java_bytes content
  raise NotImplementedError
end

#isModifiedBoolean

This method is used to determine whether the currently displayed message has been modified by the user. The hosting editor will always call #getMessage before calling this method, so any pending edits should be completed within #getMessage.

Returns:

  • (Boolean)

    The method should return true if the user has modified the current message since it was first displayed.

Raises:

  • (NotImplementedError)


88
# File 'lib/buby/message_editor_tab.rb', line 88

def isModified; raise NotImplementedError; end

#setMessage(content, isRequest) ⇒ Object

The hosting editor will invoke this method to display a new message or to clear the existing message. This method will only be called with a new message if the tab has already returned true to a call to #isEnabled with the same message details.

Parameters:

  • content (Array<byte>)

    The message that is to be displayed, or nil if the tab should clear its contents and disable any editable controls.

  • isRequest (Boolean)

    Indicates whether the message is a request or a response.

Raises:

  • (NotImplementedError)


72
# File 'lib/buby/message_editor_tab.rb', line 72

def setMessage(content, isRequest); raise NotImplementedError; end