Parser

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

class burpui.misc.parser.interface.BUIparser(app=None, conf=None)[source]

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

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
path_expander(pattern=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
  • client (str) – The client name when working on client files
Returns:

A list of files or an empty list

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_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)[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
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)[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) – Wether 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, mode='srv')[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)
  • mode (str) – We actually use the same method for clients and server files
Returns:

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

Example:

[[0, "Success"]]