Verified Commit 38c3d94f authored by Benjamin "Ziirish" SANS's avatar Benjamin "Ziirish" SANS
Browse files

prevent burp-ui from crashing when monitor is not ready (fix #318)

parent fa6d987d
Loading
Loading
Loading
Loading
Loading
+133 −126
Original line number Diff line number Diff line
@@ -966,6 +966,7 @@ def diag(client, host, tips):
    c_status_port = 4972
    errors = False
    if os.path.exists(bconfcli):
        try:
            parser = app.client.get_parser()

            confcli = Config(bconfcli, parser, 'srv')
@@ -986,13 +987,16 @@ def diag(client, host, tips):
                    '{} != {}'.format(confcli.get('server'), host)
                )
                errors = True
        except BUIserverException as exc:
            err(str(exc))
            errors = True

    else:
        err('No client conf file found: {} does not exist'.format(bconfcli))
        errors = True

    if os.path.exists(bconfsrv):

        try:
            is_burp_2_2_10_plus = False
            listen_opt = 'status_address'
            server_version = app.client.get_server_version()
@@ -1116,6 +1120,9 @@ def diag(client, host, tips):
                        'mismatch. Burp-UI will not work properly until you fix '
                        'this.'.format(bconfcli, bconfagent)
                    )
        except BUIserverException as exc:
            err(str(exc))
            errors = True
    else:
        err('Unable to locate burp-server configuration: {} does not '
            'exist.'.format(bconfsrv))
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ class MonitorPool:

        self.burpbin = self.conf.safe_get('burpbin', section='Burp')
        self.bconfcli = self.conf.safe_get('bconfcli', section='Burp')
        self.timeout = self.conf.safe_get('timeout', 'integer', section='Burp')
        self.timeout = self.conf.safe_get('timeout', 'integer', section='Burp', defaults=15)

        self.conf.setdefault('BUI_MONITOR', True)

+6 −6
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class BUIbackend(object, metaclass=ABCMeta):
        self.host = G_BURPHOST
        self.port = G_BURPPORT
        self.burpbin = G_BURPBIN
        self.stripbin = G_STRIPBIN
        self.stripbin = G_STRIPBIN2
        self.burpconfcli = G_BURPCONFCLI
        self.burpconfsrv = G_BURPCONFSRV
        self.includes = G_INCLUDES
@@ -70,7 +70,7 @@ class BUIbackend(object, metaclass=ABCMeta):
            'bport': G_BURPPORT,
            'bhost': G_BURPHOST,
            'burpbin': G_BURPBIN,
            'stripbin': G_STRIPBIN,
            'stripbin': G_STRIPBIN2,
            'bconfcli': G_BURPCONFCLI,
            'bconfsrv': G_BURPCONFSRV,
            'timeout': G_TIMEOUT,
@@ -91,7 +91,7 @@ class BUIbackend(object, metaclass=ABCMeta):
                'enforce': G_ENFORCE,
            },
        }
        self.defaults['Burp2']['stripbin'] = G_STRIPBIN2
        self.defaults['Burp1']['stripbin'] = G_STRIPBIN
        tmpdir = G_TMPDIR
        if conf is not None:
            conf.update_defaults(self.defaults)
@@ -116,9 +116,9 @@ class BUIbackend(object, metaclass=ABCMeta):
                G_BURPBIN,
                sect=section
            )
            STRIPBIN_DEFAULT = G_STRIPBIN
            if self._vers == 2:
            STRIPBIN_DEFAULT = G_STRIPBIN2
            if self._vers == 1:
                STRIPBIN_DEFAULT = G_STRIPBIN
            self.stripbin = self._get_binary_path(
                conf,
                'stripbin',
+8 −5
Original line number Diff line number Diff line
@@ -238,11 +238,14 @@ class Burp(Burp2):
                    exc = eee
                time.sleep(1)
            else:
                self.logger.error('monitor not ready, giving up!')
                raise exc
                self.logger.error(f'monitor not ready, giving up!: {exc}')

        try:
            stats = self.statistics()
            if 'alive' in stats and stats['alive']:
                self.init_all()
        except BUIserverException:
            pass

    def init_all(self):
        self._ready = True