mirror of
https://github.com/ziirish/burp-ui.git
synced 2026-05-21 06:45:24 -06:00
fix lint
This commit is contained in:
parent
7fb26bf5b9
commit
d846f0db39
4 changed files with 31 additions and 31 deletions
2
Makefile
2
Makefile
|
|
@ -28,6 +28,6 @@ clean_coverage:
|
|||
|
||||
flake8:
|
||||
@echo 'Checking pep8 compliance and errors...'
|
||||
@flake8 --ignore=E501 burpui
|
||||
@flake8 --ignore=E501,E722 burpui
|
||||
|
||||
check: pep8 pyflakes doc_coverage test
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ class Restore(Resource):
|
|||
:returns: A :mod:`flask.Response` object representing an archive of the restored files
|
||||
"""
|
||||
args = self.parser.parse_args()
|
||||
l = args['list']
|
||||
s = args['strip']
|
||||
f = args['format'] or 'zip'
|
||||
p = args['pass']
|
||||
lst = args['list']
|
||||
stp = args['strip']
|
||||
fmt = args['format'] or 'zip'
|
||||
pwd = args['pass']
|
||||
resp = None
|
||||
# Check params
|
||||
if not l or not name or not backup:
|
||||
if not lst or not name or not backup:
|
||||
self.abort(400, 'missing arguments')
|
||||
# Manage ACL
|
||||
if not current_user.is_anonymous and \
|
||||
|
|
@ -104,15 +104,15 @@ class Restore(Resource):
|
|||
name,
|
||||
server,
|
||||
strftime("%Y-%m-%d_%H_%M_%S", gmtime()),
|
||||
f)
|
||||
fmt)
|
||||
else:
|
||||
filename = 'restoration_%d_%s_at_%s.%s' % (
|
||||
backup,
|
||||
name,
|
||||
strftime("%Y-%m-%d_%H_%M_%S", gmtime()),
|
||||
f)
|
||||
fmt)
|
||||
|
||||
archive, err = bui.client.restore_files(name, backup, l, s, f, p, server)
|
||||
archive, err = bui.client.restore_files(name, backup, lst, stp, fmt, pwd, server)
|
||||
if not archive:
|
||||
if err:
|
||||
return make_response(err, 500)
|
||||
|
|
@ -142,9 +142,9 @@ class Restore(Resource):
|
|||
attachment_filename=filename,
|
||||
mimetype='application/zip')
|
||||
resp.set_cookie('fileDownload', 'true')
|
||||
except Exception as e:
|
||||
bui.client.logger.error(str(e))
|
||||
self.abort(500, str(e))
|
||||
except Exception as exp:
|
||||
bui.client.logger.error(str(exp))
|
||||
self.abort(500, str(exp))
|
||||
else:
|
||||
# Multi-agent mode
|
||||
try:
|
||||
|
|
@ -157,25 +157,25 @@ class Restore(Resource):
|
|||
|
||||
bui.client.logger.debug('Need to get {} Bytes : {}'.format(length, socket))
|
||||
|
||||
def stream_file(sock, l):
|
||||
def stream_file(sock, size):
|
||||
"""The restoration took place on another server so we need
|
||||
to stream the file that is not present on the current
|
||||
machine.
|
||||
"""
|
||||
bsize = 1024
|
||||
received = 0
|
||||
if l < bsize:
|
||||
bsize = l
|
||||
while received < l:
|
||||
if size < bsize:
|
||||
bsize = size
|
||||
while received < size:
|
||||
buf = b''
|
||||
r, _, _ = select.select([sock], [], [], 5)
|
||||
if not r:
|
||||
read, _, _ = select.select([sock], [], [], 5)
|
||||
if not read:
|
||||
raise Exception('Socket timed-out')
|
||||
buf += sock.recv(bsize)
|
||||
if not buf:
|
||||
continue
|
||||
received += len(buf)
|
||||
self.logger.debug('{}/{}'.format(received, l))
|
||||
self.logger.debug('{}/{}'.format(received, size))
|
||||
yield buf
|
||||
sock.sendall(struct.pack('!Q', 2))
|
||||
sock.sendall(b'RE')
|
||||
|
|
@ -196,11 +196,11 @@ class Restore(Resource):
|
|||
time(),
|
||||
length,
|
||||
adler32(filename.encode('utf-8')) & 0xffffffff))
|
||||
except HTTPException as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
bui.client.logger.error(str(e))
|
||||
self.abort(500, str(e))
|
||||
except HTTPException as exp:
|
||||
raise exp
|
||||
except Exception as exp:
|
||||
bui.client.logger.error(str(exp))
|
||||
self.abort(500, str(exp))
|
||||
return resp
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -205,10 +205,10 @@ class LdapLoader(BUIloader):
|
|||
:returns: True if bind was successful, otherwise False
|
||||
"""
|
||||
try:
|
||||
with Connection(self.server, user='{0}'.format(dn), password=passwd, raise_exceptions=True, auto_bind=self.auto_bind, authentication=SIMPLE) as l:
|
||||
self.logger.debug('LDAP Connection = {0}'.format(str(l)))
|
||||
with Connection(self.server, user='{0}'.format(dn), password=passwd, raise_exceptions=True, auto_bind=self.auto_bind, authentication=SIMPLE) as con:
|
||||
self.logger.debug('LDAP Connection = {0}'.format(str(con)))
|
||||
self.logger.info('Bound as user: {0}'.format(dn))
|
||||
return l.bind()
|
||||
return con.bind()
|
||||
except Exception as e:
|
||||
self.logger.error('Failed to authenticate user: {0}, {1}'.format(dn, str(e)))
|
||||
|
||||
|
|
|
|||
|
|
@ -290,15 +290,15 @@ def client_report(server=None, name=None):
|
|||
"""Specific client report"""
|
||||
server = server or request.args.get('serverName')
|
||||
try:
|
||||
l = bui.client.get_client(name, agent=server)
|
||||
res = bui.client.get_client(name, agent=server)
|
||||
except BUIserverException:
|
||||
l = []
|
||||
if len(l) == 1:
|
||||
res = []
|
||||
if len(res) == 1:
|
||||
return redirect(
|
||||
url_for(
|
||||
'.backup_report',
|
||||
name=name,
|
||||
backup=l[0]['number'],
|
||||
backup=res[0]['number'],
|
||||
server=server
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue