mirror of
https://github.com/ziirish/burp-ui.git
synced 2026-05-21 06:45:24 -06:00
add: allow to delete clients data upon removal (fix #232)
This commit is contained in:
parent
b38e3c9de5
commit
e394744162
6 changed files with 20 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ import re
|
|||
import os
|
||||
import json
|
||||
import codecs
|
||||
import shutil
|
||||
|
||||
from glob import glob
|
||||
|
||||
|
|
@ -288,7 +289,7 @@ class Parser(Doc):
|
|||
self.templates_mtime = os.path.getmtime(self.templates_path)
|
||||
return res
|
||||
|
||||
def _get_server_path(self, name=None, fil=None):
|
||||
def _get_server_path(self, name=None, fil=''):
|
||||
"""Returns the path of the 'server *fil*' file"""
|
||||
if not name:
|
||||
raise BUIserverException('Missing name')
|
||||
|
|
@ -344,7 +345,8 @@ class Parser(Doc):
|
|||
return False
|
||||
return self.openssl_auth.check_client_revoked(client)
|
||||
|
||||
def remove_client(self, client=None, keepconf=False, delcert=False, revoke=False, template=False):
|
||||
def remove_client(self, client=None, keepconf=False, delcert=False, revoke=False,
|
||||
template=False, delete=False):
|
||||
"""See :func:`burpui.misc.parser.interface.BUIparser.remove_client`"""
|
||||
res = []
|
||||
revoked = False
|
||||
|
|
@ -352,6 +354,7 @@ class Parser(Doc):
|
|||
if not client:
|
||||
return [[NOTIF_ERROR, "No client provided"]]
|
||||
try:
|
||||
data = self._get_server_path(client)
|
||||
if not keepconf:
|
||||
if template:
|
||||
path = os.path.join(self.templates_path, client)
|
||||
|
|
@ -370,6 +373,8 @@ class Parser(Doc):
|
|||
|
||||
self._refresh_cache()
|
||||
|
||||
shutil.rmtree(data)
|
||||
|
||||
except OSError as exp:
|
||||
res.append([NOTIF_ERROR, str(exp)])
|
||||
|
||||
|
|
|
|||
|
|
@ -263,7 +263,8 @@ class BUIparser(object, metaclass=ABCMeta):
|
|||
) # pragma: no cover
|
||||
|
||||
@abstractmethod
|
||||
def remove_client(self, client=None, keepconf=False, delcert=False, revoke=False, template=False):
|
||||
def remove_client(self, client=None, keepconf=False, delcert=False, revoke=False,
|
||||
template=False, delete=False):
|
||||
""":func:`burpui.misc.parser.interface.BUIparser.remove_client` is used
|
||||
to delete a client from burp's configuration.
|
||||
|
||||
|
|
@ -282,8 +283,12 @@ class BUIparser(object, metaclass=ABCMeta):
|
|||
:param template: Whether we remove a template
|
||||
:type template: bool
|
||||
|
||||
:param delete: Whether to remove data as well
|
||||
:type delete: bool
|
||||
|
||||
:returns: A list of notifications to return to the UI (success or
|
||||
failure)
|
||||
:rtype: list
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"Sorry, the current Parser does not implement this method!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue