cleanup configs

This commit is contained in:
ziirish 2017-08-01 18:27:53 +02:00
parent bf00cccc3a
commit ccc649eb19
19 changed files with 71 additions and 119 deletions

View file

@ -315,14 +315,14 @@ def setup_burp(bconfcli, bconfsrv, client, host, redis, database, plugins, dry):
(_, temp) = tempfile.mkstemp()
app.conf.options.filename = temp
if not app.conf.lookup_section('Burp2', source):
if not app.conf.lookup_section('Burp', source):
app.conf._refresh(True)
if not app.conf.lookup_section('Global', source):
app.conf._refresh(True)
if (database or redis) and not app.conf.lookup_section('Production', source):
app.conf._refresh(True)
def _edit_conf(key, val, attr, section='Burp2', obj=app.client):
def _edit_conf(key, val, attr, section='Burp', obj=app.client):
if val and (((key not in app.conf.options[section]) or
(key in app.conf.options[section] and
val != app.conf.options[section][key])) and
@ -440,9 +440,9 @@ def setup_burp(bconfcli, bconfsrv, client, host, redis, database, plugins, dry):
if out:
click.echo_via_pager(out)
bconfcli = bconfcli or app.conf.options['Burp2'].get('bconfcli') or \
bconfcli = bconfcli or app.conf.options['Burp'].get('bconfcli') or \
getattr(app.client, 'burpconfcli')
bconfsrv = bconfsrv or app.conf.options['Burp2'].get('bconfsrv') or \
bconfsrv = bconfsrv or app.conf.options['Burp'].get('bconfsrv') or \
getattr(app.client, 'burpconfsrv')
dest_bconfcli = bconfcli
@ -773,9 +773,9 @@ def diag(client, host, tips):
)
)
bconfcli = app.conf.options.get('Burp2', {}).get('bconfcli') or \
bconfcli = app.conf.options.get('Burp', {}).get('bconfcli') or \
getattr(app.client, 'burpconfcli')
bconfsrv = app.conf.options.get('Burp2', {}).get('bconfsrv') or \
bconfsrv = app.conf.options.get('Burp', {}).get('bconfsrv') or \
getattr(app.client, 'burpconfsrv')
errors = False
@ -988,7 +988,7 @@ def sysinfo(verbose):
))
sections = [
'WebSocket',
'Burp{}'.format(app.vers),
'Burp',
'Production',
'Global',
]

View file

@ -172,34 +172,6 @@ class Burp(BUIbackend):
except BUIserverException:
pass
# Utilities functions
def _get_binary_path(self, config, field, default=None, sect='Burp1'):
"""Helper function to retrieve a binary path from the configuration
:param field: Field name to look for
:type field: str
:param default: Default value in case the retrieved value is not correct
:type default: str
"""
temp = config.safe_get(field, section=sect) or default
if temp and not temp.startswith('/'):
self.logger.warning("Please provide an absolute path for the '{}' option. Fallback to '{}'".format(field, default))
temp = default
elif temp and not re.match(r'^\S+$', temp):
self.logger.warning("Incorrect value for the '{}' option. Fallback to '{}'".format(field, default))
temp = default
elif temp and (not os.path.isfile(temp) or not os.access(temp, os.X_OK)):
self.logger.warning("'{}' does not exist or is not executable. Fallback to '{}'".format(temp, default))
temp = default
if temp and (not os.path.isfile(temp) or not os.access(temp, os.X_OK)): # pragma: no cover
self.logger.error("Ooops, '{}' not found or is not executable".format(temp))
temp = None
return temp
@staticmethod
def _get_inet_family(addr):
"""The :func:`burpui.misc.backend.burp1.Burp._get_inet_family` function

View file

@ -187,6 +187,34 @@ class BUIbackend(with_metaclass(ABCMeta, object)):
self.tmpdir = tmpdir
# Utilities functions
def _get_binary_path(self, config, field, default=None, sect='Burp'):
"""Helper function to retrieve a binary path from the configuration
:param field: Field name to look for
:type field: str
:param default: Default value in case the retrieved value is not correct
:type default: str
"""
temp = config.safe_get(field, section=sect) or default
if temp and not temp.startswith('/'):
self.logger.warning("Please provide an absolute path for the '{}' option. Fallback to '{}'".format(field, default))
temp = default
elif temp and not re.match(r'^\S+$', temp):
self.logger.warning("Incorrect value for the '{}' option. Fallback to '{}'".format(field, default))
temp = default
elif temp and (not os.path.isfile(temp) or not os.access(temp, os.X_OK)):
self.logger.warning("'{}' does not exist or is not executable. Fallback to '{}'".format(temp, default))
temp = default
if temp and (not os.path.isfile(temp) or not os.access(temp, os.X_OK)): # pragma: no cover
self.logger.error("Ooops, '{}' not found or is not executable".format(temp))
temp = None
return temp
"""
Utilities functions
"""

View file

@ -16,7 +16,7 @@ version = 1
password = azerty
## burp1 backend specific options
[Burp1]
[Burp]
## burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
## burp status port

View file

@ -15,7 +15,7 @@ version = 2
# agent password
password = azerty
[Burp2]
[Burp]
tmpdir = /tmp/bui/
timeout = 30
bconfcli = /tmp/burp.conf

View file

@ -96,8 +96,8 @@ zip64 = false
# `server_can_restore = 0`
noserverrestore = true
## burp1 backend specific options
#[Burp1]
## burp backend specific options
#[Burp]
## burp status address (can only be '127.0.0.1' or '::1')
#bhost = ::1
## burp status port
@ -112,19 +112,8 @@ noserverrestore = true
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
#tmpdir = /tmp/bui
## burp2 backend specific options
#[Burp2]
## burp binary
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/sbin/vss_strip
## burp client configuration file used for the restoration (Default: None)
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
#tmpdir = /tmp/bui
## how many time to wait for the monitor to answer (in seconds)
#timeout = 15
## ldapauth specific options
#[LDAP]

View file

@ -67,8 +67,8 @@ scookie = true
# /!\ YOU CANNOT USE THE MAGIC 'random' VALUE WHEN USING GUNICORN /!\
appsecret = random
## burp1 backend specific options
#[Burp1]
## burp backend specific options
[Burp]
## burp status address (can only be '127.0.0.1' or '::1')
#bhost = ::1
## burp status port
@ -76,26 +76,15 @@ appsecret = random
## burp binary
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/sbin/vss_strip
## burp client configuration file used for the restoration (Default: None)
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
#tmpdir = /tmp/bui
## burp2 backend specific options
[Burp2]
## burp binary
#burpbin = /usr/sbin/burp
## vss_strip binary
stripbin = /usr/bin/vss_strip
## burp client configuration file used for the restoration (Default: None)
## burp client configuration file used for the restoration
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
tmpdir = /tmp/bui
## how many time to wait for the monitor to answer (in seconds)
#timeout = 15
## ldapauth specific options
#[LDAP]

View file

@ -260,7 +260,7 @@ Example:
>>>>> Extra verbose informations:
!!! PLEASE MAKE SURE NO SENSITIVE DATA GET EXPOSED !!!
[Burp2] section:
[Burp] section:
8<---------------------------------------------------------------------BEGIN
8<-----------------------------------------------------------------------END

View file

@ -42,8 +42,8 @@ revoke = true
# commands on Unix (the InfoZIP utilities) dont support these extensions. »
zip64 = false
## burp1 backend specific options
#[Burp1]
## burp backend specific options
#[Burp]
## burp status address (can only be '127.0.0.1' or '::1')
#bhost = 127.0.0.1
## burp status port
@ -52,20 +52,7 @@ zip64 = false
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/sbin/vss_strip
## burp client configuration file used for the restoration (Default: None)
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
#tmpdir = /tmp/bui
## burp2 backend specific options
#[Burp2]
## burp binary
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/sbin/vss_strip
## burp client configuration file used for the restoration (Default: None)
## burp client configuration file used for the restoration
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf

View file

@ -144,8 +144,8 @@ zip64 = false
# `server_can_restore = 0`
noserverrestore = false
## burp1 backend specific options
#[Burp1]
## burp backend specific options
#[Burp]
## burp status address (can only be '127.0.0.1' or '::1')
#bhost = ::1
## burp status port
@ -154,20 +154,7 @@ noserverrestore = false
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/sbin/vss_strip
## burp client configuration file used for the restoration (Default: None)
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf
## temporary directory to use for restoration
#tmpdir = /tmp/bui
## burp2 backend specific options
#[Burp2]
## burp binary
#burpbin = /usr/sbin/burp
## vss_strip binary
#stripbin = /usr/bin/vss_strip
## burp client configuration file used for the restoration (Default: None)
## burp client configuration file used for the restoration
#bconfcli = /etc/burp/burp.conf
## burp server configuration file used for the setting page
#bconfsrv = /etc/burp/burp-server.conf

View file

@ -28,8 +28,8 @@ auth = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
bhost = 127.0.0.1
# burp status port

View file

@ -28,8 +28,8 @@ auth = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
bhost = ::1
# burp status port

View file

@ -32,8 +32,8 @@ acl = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
bhost = 127.0.0.1
# burp status port

View file

@ -32,8 +32,8 @@ acl = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
bhost = 192.168.1.1
# burp status port

View file

@ -32,8 +32,8 @@ acl = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
# burp status port

View file

@ -32,8 +32,8 @@ acl = basic
# refresh interval of the pages in seconds
refresh = 15
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
# burp status port

View file

@ -65,8 +65,8 @@ celery = true
# example: sqlite:////var/lib/burpui/store.db
database = sqlite:////tmp/store.db
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
# burp status port

View file

@ -65,8 +65,8 @@ celery = true
# example: sqlite:////var/lib/burpui/store.db
database = sqlite:////somewhere/you/dont/have/rights
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
# burp status port

View file

@ -65,8 +65,8 @@ celery = false
# example: sqlite:////var/lib/burpui/store.db
database = sqlite://
# burp1 backend specific options
[Burp1]
# burp backend specific options
[Burp]
# burp status address (can only be '127.0.0.1' or '::1'
#bhost = 127.0.0.1
# burp status port