Skip to content

Custom Message Editors

Chopicalqui edited this page Apr 2, 2022 · 4 revisions

This tab implements the interface IMessageEditorTab of the Burp Suite Extender API. We can use it to create our own custom tabs within HTTP message editors.

Our Python script must implement the following three methods; for more information refer to the IMessageEditorTab specification.

def is_enabled(content, is_request, session):
    """
    This method is invoked before an HTTP message is displayed in an custom editor tab, so that this custom 
    tab can indicate whether it should be enabled for that message.
    
    For more information, refer to the Burp Suite API, IMessageEditorTab interface, method isEnabled.
    :param content (List[bytes]): The message that is about to be displayed by this custom editor tab, or a 
    zero-length array if the existing message is to be cleared.
    :param is_request (bool): Indicates whether the message is a request or a response.
    :param session (dict): The dictionary allows storing information accross method calls.
    :return (bool) 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.
    """
    result = True
    # todo: implement code
    return result

def set_message(content, is_request, session):
    """
    This method compiles the message to be displayed in this custom editor tab.
    
    For more information, refer to the Burp Suite API, IMessageEditorTab interface, method set_message.
    :param content (List[bytes]): The original message based on which the new message, which is going to be 
    displayed by this custom editor tab, is created.
    :param is_request (bool): Indicates whether the message is a request or a response.
    :param session (dict): The dictionary allows storing information accross method calls.
    :return (List[bytes]) Returns the modified content of variable content.
    """
    result = content
    # todo: decode content
    return result

def get_message(content, session):
    """
    This method converts back the currently displayed message.
    
    For more information, refer to the Burp Suite API, IMessageEditorTab interface, method set_message.
    :param content (List[bytes]): The original message based on which the new message, which is going to be 
    displayed by this custom editor tab, is created.
    :param session (dict): The dictionary allows storing information accross method calls.
    :return (List[bytes]) Returns the modified content of variable content.
    """
    result = None
    # todo: encode contents
    return result

Note: The last parameter session is of type dict and can be used to store information across methods. The parameter header is of type list and can be used to specify column header names in the JTable component, which is part of the IMessageEditorTab. The parameter rows is a two-dimensional list, which can be used to add rows to the JTable component. For more information refer to the table in the next section.