mirror of
https://github.com/ziirish/burp-ui.git
synced 2026-05-21 06:45:24 -06:00
add: support stats from 1.4.x upgrade in burp 2 backend (#81)
This commit is contained in:
parent
417c6a60c5
commit
88ddaf013a
4 changed files with 22 additions and 8 deletions
|
|
@ -9,6 +9,9 @@ Current
|
|||
- Add `server-side initiated restoration <https://git.ziirish.me/ziirish/burp-ui/issues/12>`_
|
||||
- Add percent done in `overview <https://git.ziirish.me/ziirish/burp-ui/issues/55>`_
|
||||
- Add the ability to `chain multiple authentication backends <https://git.ziirish.me/ziirish/burp-ui/issues/79>`_
|
||||
- Add Basic HTTP Authentication
|
||||
- Add full documented API
|
||||
- Fix issue `#81 <https://git.ziirish.me/ziirish/burp-ui/issues/81>`_
|
||||
- `Full changelog <https://git.ziirish.me/ziirish/burp-ui/compare/v0.0.7.1...master>`__
|
||||
|
||||
0.0.7.3
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ class Burp(BUIbackend):
|
|||
ret['encrypted'] = True
|
||||
return ret
|
||||
|
||||
def _parse_backup_stats(self, number, client, forward=False, agent=None): # pragma: no cover
|
||||
def _parse_backup_stats(self, number, client, forward=False, stats=None, agent=None):
|
||||
"""The :func:`burpui.misc.backend.burp1.Burp._parse_backup_stats`
|
||||
function is used to parse the burp logs.
|
||||
|
||||
|
|
@ -427,7 +427,10 @@ class Burp(BUIbackend):
|
|||
'total_scanned': ['total', 'scanned'],
|
||||
'total_total': ['total', 'total']
|
||||
}
|
||||
f = self.status('c:{0}:b:{1}:f:backup_stats\n'.format(client, number), agent=agent)
|
||||
if not stats:
|
||||
f = self.status('c:{0}:b:{1}:f:backup_stats\n'.format(client, number), agent=agent)
|
||||
else:
|
||||
f = stats
|
||||
for line in f:
|
||||
if line == '-list begin-' or line == '-list end-':
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -382,12 +382,17 @@ class Burp(Burp1):
|
|||
back = backups[0]
|
||||
if 'backup_stats' not in back['logs']:
|
||||
return {}
|
||||
stats = None
|
||||
try:
|
||||
stats = json.loads(''.join(back['logs']['backup_stats']))
|
||||
except:
|
||||
pass
|
||||
stats = back['logs']['backup_stats']
|
||||
print stats
|
||||
if not stats:
|
||||
return {}
|
||||
# server was upgraded but backup comes from an older version
|
||||
if 'counters' not in stats:
|
||||
return super(Burp, self)._parse_backup_stats(number, client, forward, stats, agent)
|
||||
counters = stats['counters']
|
||||
for counter in counters:
|
||||
name = counter['name']
|
||||
|
|
@ -599,10 +604,13 @@ class Burp(Burp1):
|
|||
ba['deletable'] = False
|
||||
ba['date'] = datetime.datetime.fromtimestamp(backup['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
|
||||
log = self.get_backup_logs(backup['number'], name)
|
||||
ba['encrypted'] = log['encrypted']
|
||||
ba['received'] = log['received']
|
||||
ba['size'] = log['totsize']
|
||||
r.append(ba)
|
||||
try:
|
||||
ba['encrypted'] = log['encrypted']
|
||||
ba['received'] = log['received']
|
||||
ba['size'] = log['totsize']
|
||||
r.append(ba)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Here we need to reverse the array so the backups are sorted by date ASC
|
||||
r.reverse()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ ISROOT=0
|
|||
UPDATED=0
|
||||
BURP="https://git.ziirish.me/ziirish/burp.git"
|
||||
BURP_VERSION="1.4.40"
|
||||
BURP2_VERSION="2.0.20"
|
||||
BURP2_VERSION="2.0.26"
|
||||
|
||||
function update() {
|
||||
[ $UPDATED -eq 0 ] && [ $ISROOT -eq 1 ] && {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue