Class: Buby::MessageEditorTab Abstract

Inherits:
Object
  • Object
show all
Extended by:
Java::Burp::IMessageEditorTabFactory
Includes:
Java::Burp::IMessageEditorTab
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.



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

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

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#ui_componentObject

Returns the value of attribute ui_component.



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

def ui_component
  @ui_component
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.



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

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

Instance Method Details

#enabled?(content, is_request = true) ⇒ Boolean

Deprecated.

This will become a raw version/proxied version pair like ContextMenuFactory#createMenuItems in 2.0.

Returns:

  • (Boolean)


64
65
66
# File 'lib/buby/message_editor_tab.rb', line 64

def enabled?(content, is_request = true)
  isEnabled(content, is_request)
end

#getMessageArray<byte>

Deprecated.

This will become a raw version/proxied version pair like ContextMenuFactory#createMenuItems in 2.0.

This method returns the currently displayed message.

Returns:

  • (Array<byte>)

    The currently displayed message.



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

def getMessage; @message.to_java_bytes 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)


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

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.



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

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.



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

def getUiComponent; @ui_component end

#isEnabled(content, isRequest = true) ⇒ Boolean

Deprecated.

This will become a raw version/proxied version pair like ContextMenuFactory#createMenuItems in 2.0.

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) (defaults to: true)

    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)


58
59
60
61
# File 'lib/buby/message_editor_tab.rb', line 58

def isEnabled(content, isRequest = true)
  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.



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

def isModified; false end

#setMessage(content, isRequest) ⇒ Object

Deprecated.

This will become a raw version/proxied version pair like ContextMenuFactory#createMenuItems in 2.0.

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)


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

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