Parser

Here is the parser interface definition in order to implement a new parser.

class burpui.misc.parser.interface.BUIparser[source]

burpui.misc.parser.interface.BUIparser defines a generic interface for burp configuration files parser.

cancel_backup(name=None)[source]

burpui.misc.parser.interface.BUIparser.cancel_backup() called by burpui.misc.backend.interface.BUIbackend.cancel_server_backup() in order to cancel a server-initiated backup.

Parameters:name (str) – Client name
Returns:A list of notifications to return to the UI (success or failure)
cancel_restore(name=None)[source]

burpui.misc.parser.interface.BUIparser.cancel_restore() called by burpui.misc.backend.interface.BUIbackend.cancel_server_restore() in order to cancel a server-initiated restoration.

Parameters:name (str) – Client name
Returns:A list of notifications to return to the UI (success or failure)
is_client_revoked(client=None)[source]

burpui.misc.parser.interface.BUIparser.is_client_revoked() is used to check if a given client has it’s certificate revoked or not.

Parameters:client (str) – The name of the client to check
Returns:True or False
list_clients()[source]

burpui.misc.parser.interface.BUIparser.list_clients() is used to retrieve a list of clients with their configuration file.

Returns:A list of clients with their configuration file
param(name, obj='server_conf', client=None)[source]

burpui.misc.parser.interface.BUIparser.param() lookup for a given param in the conf.

Parameters:
  • name (str) – Param name
  • obj (str) – Object to look param for
  • client (str) – Search for a given client param
Returns:

The asked param

path_expander(pattern=None, source=None, client=None)[source]

burpui.misc.parser.interface.BUIparser.path_expander() is used to expand path of file inclusions glob the user can set in the setting panel.

Parameters:
  • pattern (str) – The glob/path to expand
  • source (str) – What file we are working in
  • client (str) – The client name when working on client files
Returns:

A list of files or an empty list

read_backup(name=None)[source]

burpui.misc.parser.interface.BUIparser.read_backup() called by burpui.misc.backend.interface.BUIbackend.is_server_backup() in order to test the existence of a server-initiated backup file.

Parameters:name (str) – Client name
Returns:A True if the file is found, else False.
read_client_conf(client=None, conf=None)[source]

burpui.misc.parser.interface.BUIparser.read_client_conf() is called by burpui.misc.backend.interface.BUIbackend.read_conf_cli() in order to parse the burp-clients configuration files.

It works the same way as burpui.misc.parser.interface.BUIparser.read_server_conf()

read_restore(name=None)[source]

burpui.misc.parser.interface.BUIparser.read_restore() called by burpui.misc.backend.interface.BUIbackend.is_server_restore() in order to read a server-initiated restoration file.

Parameters:name (str) – Client name
Returns:A dict describing the content of the file
read_server_conf(conf=None)[source]

burpui.misc.parser.interface.BUIparser.read_server_conf() is called by burpui.misc.backend.interface.BUIbackend.read_conf_srv() in order to parse the burp-server configuration file.

Parameters:conf (str) – Complementary configuration file (for instance, file inclusions)
Returns:Dict of options

Example:

{
    "boolean": [
        {
            "name": "hardlinked_archive",
            "value": false
        },
        {
            "name": "syslog",
            "value": true
        },
    ],
    "clients": [
        {
            "name": "client1",
            "value": "/etc/burp/clientconfdir/client1"
        },
        {
            "name": "client2",
            "value": "/etc/burp/clientconfdir/client2"
        },
    ],
    "common": [
        {
            "name": "mode",
            "value": "server"
        },
        {
            "name": "directory",
            "value": "/srv/burp"
        },
    ],
    "includes": [],
    "includes_ext": [],
    "integer": [
        {
            "name": "port",
            "value": 4971
        },
        {
            "name": "status_port",
            "value": 4972
        },
        {
            "name": "max_children",
            "value": 5
        },
        {
            "name": "max_status_children",
            "value": 5
        }
    ],
    "multi": [
        {
            "name": "keep",
            "value": [
                "7",
                "4",
                "4"
            ]
        },
        {
            "name": "timer_arg",
            "value": [
                "12h",
                "Mon,Tue,Thu,Fri,17,18,19,20,21,22,23",
                "Wed,Sat,Sun,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23"
            ]
        },
    ],
}
remove_client(client=None, keepconf=False, delcert=False, revoke=False)[source]

burpui.misc.parser.interface.BUIparser.remove_client() is used to delete a client from burp’s configuration.

Parameters:
  • client (str) – The name of the client to remove
  • keepconf – Whether to keep the conf (in order to just revoke/delete the cert)
  • keepconf – bool
  • delcert (bool) – Whether to delete the associated certificate
  • revoke (bool) – Whether to revoke the associated certificate
Returns:

A list of notifications to return to the UI (success or failure)

server_initiated_backup(name=None)[source]

burpui.misc.parser.interface.BUIparser.server_initiated_backup() called by burpui.misc.backend.interface.BUIbackend.server_backup() in order to create a server-initiated backup file.

Parameters:name (str) – Client name
Returns:A list of notifications to return to the UI (success or failure)
server_initiated_restoration(name=None, backup=None, files=None, strip=None, force=None, prefix=None, restoreto=None)[source]

burpui.misc.parser.interface.BUIparser.server_initiated_restoration() called by burpui.misc.backend.interface.BUIbackend.server_restore() in order to create server-initiated restoration file.

Parameters:
  • name (str) – Client name
  • backup (int) – Backup number
  • files (str) – List of files to restore
  • strip (int) – Number of leading path to strip
  • force (bool) – Whether to force overriding files or not
  • prefix (str) – Where to restore files
  • agent (str) – What server to ask (only in multi-agent mode)
Returns:

A list of notifications to return to the UI (success or failure)

store_client_conf(data, client=None, conf=None)[source]

burpui.misc.parser.interface.BUIparser.store_client_conf() is used by burpui.misc.backend.BUIbackend.store_conf_cli().

It works the same way as burpui.misc.parser.interface.BUIparser.store_conf() with an extra parameter:

Parameters:client (str) – Name of the client for which to apply this config
store_conf(data, conf=None, client=None, mode='srv', insecure=False)[source]

burpui.misc.parser.interface.BUIparser.store_conf() is used to store the configuration from the web-ui into the actual configuration files. It is used by burpui.misc.backend.BUIbackend.store_conf_srv().

Parameters:
  • data (dict) – Data sent by the web-form
  • conf (str) – Force the file path (for file inclusions for instance)
  • client (str) – Client name
  • mode (str) – We actually use the same method for clients and server files
  • insecure (bool) – Used for the CLI
Returns:

A list of notifications to return to the UI (success or failure)

Example:

[[0, "Success"]]