Backtrace when a client is running for the first time
Hi,
While trying to access the dashboard, I can't see any client. After digging a bit it's due to the fact that the parser does not handle things well when a client is run for the first time.
Here is the backtrace:
DEBUG in burp1 [/usr/local/lib/python2.7/dist-packages/burpui/misc/backend/burp1.py:143]:
infos: '2 108310/0/0/0/112694 84176/0/0/0/88560 0/0/0/0/0 0/0/0/0/0 0/0/0/0/0 12892/0/0/0/12892 112'
--------------------------------------------------------------------------------
::1 - - [01/Dec/2014 21:45:32] "GET /api/running.json HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/flask_login.py", line 755, in decorated_view
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/burpui/routes.py", line 192, in backup_running
j = bui.cli.is_one_backup_running(server)
File "/usr/local/lib/python2.7/dist-packages/burpui/misc/backend/burp1.py", line 341, in is_one_backup_running
cls = self.get_all_clients()
File "/usr/local/lib/python2.7/dist-packages/burpui/misc/backend/burp1.py", line 373, in get_all_clients
c['last'] = datetime.datetime.fromtimestamp(int(sp[len(sp)-2])).strftime('%Y-%m-%d %H:%M:%S')
ValueError: invalid literal for int() with base 10: '12892/0/0/0/12892'
A quick workaround is to check for this and make so that c['last'] is set to 'never':
--- /usr/local/lib/python2.7/dist-packages/burpui/misc/backend/burp1.py.orig 2014-12-01 21:55:53.435053447 +0100
+++ /usr/local/lib/python2.7/dist-packages/burpui/misc/backend/burp1.py 2014-12-01 21:48:19.636919563 +0100
@@ -370,7 +370,10 @@
c['last'] = datetime.datetime.fromtimestamp(int(sp[2])).strftime('%Y-%m-%d %H:%M:%S')
else:
sp = infos.split('\t')
- c['last'] = datetime.datetime.fromtimestamp(int(sp[len(sp)-2])).strftime('%Y-%m-%d %H:%M:%S')
+ try:
+ c['last'] = datetime.datetime.fromtimestamp(int(sp[len(sp)-2])).strftime('%Y-%m-%d %H:%M:%S')
+ except:
+ c['last'] = 'never'
j.append(c)
return j
Thanks.