

def _parse_backup_stats(self, number, client, forward=False, stats=None, agent=None):
    'The :func:`burpui.misc.backend.burp1.Burp._parse_backup_stats`\n        function is used to parse the burp logs.\n\n        :param number: Backup number to work on\n        :type number: int\n\n        :param client: Client name to work on\n        :type client: str\n\n        :param forward: Is the client name needed in later process\n        :type forward: bool\n\n        :param agent: What server to ask (only in multi-agent mode)\n        :type agent: str\n\n        :returns: Dict containing the backup log\n        '
    backup = {
        'windows': 'unknown',
        'number': int(number),
    }
    if forward:
        backup['name'] = client
    keys = {
        'time_start': 'start',
        'time_end': 'end',
        'time_taken': 'duration',
        'bytes_in_backup': 'totsize',
        'bytes_received': 'received',
        'files': ['files', 'new'],
        'files_changed': ['files', 'changed'],
        'files_same': ['files', 'unchanged'],
        'files_deleted': ['files', 'deleted'],
        'files_scanned': ['files', 'scanned'],
        'files_total': ['files', 'total'],
        'files_encrypted': ['files_enc', 'new'],
        'files_encrypted_changed': ['files_enc', 'changed'],
        'files_encrypted_same': ['files_enc', 'unchanged'],
        'files_encrypted_deleted': ['files_enc', 'deleted'],
        'files_encrypted_scanned': ['files_enc', 'scanned'],
        'files_encrypted_total': ['files_enc', 'total'],
        'directories': ['dir', 'new'],
        'directories_changed': ['dir', 'changed'],
        'directories_same': ['dir', 'unchanged'],
        'directories_deleted': ['dir', 'deleted'],
        'directories_scanned': ['dir', 'scanned'],
        'directories_total': ['dir', 'total'],
        'soft_links': ['softlink', 'new'],
        'soft_links_changed': ['softlink', 'changed'],
        'soft_links_same': ['softlink', 'unchanged'],
        'soft_links_deleted': ['softlink', 'deleted'],
        'soft_links_scanned': ['softlink', 'scanned'],
        'soft_links_total': ['softlink', 'total'],
        'hard_links': ['hardlink', 'new'],
        'hard_links_changed': ['hardlink', 'changed'],
        'hard_links_same': ['hardlink', 'unchanged'],
        'hard_links_deleted': ['hardlink', 'deleted'],
        'hard_links_scanned': ['hardlink', 'scanned'],
        'hard_links_total': ['hardlink', 'total'],
        'meta_data': ['meta', 'new'],
        'meta_data_changed': ['meta', 'changed'],
        'meta_data_same': ['meta', 'unchanged'],
        'meta_data_deleted': ['meta', 'deleted'],
        'meta_data_scanned': ['meta', 'scanned'],
        'meta_data_total': ['meta', 'total'],
        'meta_data_encrypted': ['meta_enc', 'new'],
        'meta_data_encrypted_changed': ['meta_enc', 'changed'],
        'meta_data_encrypted_same': ['meta_enc', 'unchanged'],
        'meta_data_encrypted_deleted': ['meta_enc', 'deleted'],
        'meta_data_encrypted_scanned': ['meta_enc', 'scanned'],
        'meta_data_encrypted_total': ['meta_enc', 'total'],
        'special_files': ['special', 'new'],
        'special_files_changed': ['special', 'changed'],
        'special_files_same': ['special', 'unchanged'],
        'special_files_deleted': ['special', 'deleted'],
        'special_files_scanned': ['special', 'scanned'],
        'special_files_total': ['special', 'total'],
        'efs_files': ['efs', 'new'],
        'efs_files_changed': ['efs', 'changed'],
        'efs_files_same': ['efs', 'unchanged'],
        'efs_files_deleted': ['efs', 'deleted'],
        'efs_files_scanned': ['efs', 'scanned'],
        'efs_files_total': ['efs', 'total'],
        'vss_headers': ['vssheader', 'new'],
        'vss_headers_changed': ['vssheader', 'changed'],
        'vss_headers_same': ['vssheader', 'unchanged'],
        'vss_headers_deleted': ['vssheader', 'deleted'],
        'vss_headers_scanned': ['vssheader', 'scanned'],
        'vss_headers_total': ['vssheader', 'total'],
        'vss_headers_encrypted': ['vssheader_enc', 'new'],
        'vss_headers_encrypted_changed': ['vssheader_enc', 'changed'],
        'vss_headers_encrypted_same': ['vssheader_enc', 'unchanged'],
        'vss_headers_encrypted_deleted': ['vssheader_enc', 'deleted'],
        'vss_headers_encrypted_scanned': ['vssheader_enc', 'scanned'],
        'vss_headers_encrypted_total': ['vssheader_enc', 'total'],
        'vss_footers': ['vssfooter', 'new'],
        'vss_footers_changed': ['vssfooter', 'changed'],
        'vss_footers_same': ['vssfooter', 'unchanged'],
        'vss_footers_deleted': ['vssfooter', 'deleted'],
        'vss_footers_scanned': ['vssfooter', 'scanned'],
        'vss_footers_total': ['vssfooter', 'total'],
        'vss_footers_encrypted': ['vssfooter_enc', 'new'],
        'vss_footers_encrypted_changed': ['vssfooter_enc', 'changed'],
        'vss_footers_encrypted_same': ['vssfooter_enc', 'unchanged'],
        'vss_footers_encrypted_deleted': ['vssfooter_enc', 'deleted'],
        'vss_footers_encrypted_scanned': ['vssfooter_enc', 'scanned'],
        'vss_footers_encrypted_total': ['vssfooter_enc', 'total'],
        'total': ['total', 'new'],
        'total_changed': ['total', 'changed'],
        'total_same': ['total', 'unchanged'],
        'total_deleted': ['total', 'deleted'],
        'total_scanned': ['total', 'scanned'],
        'total_total': ['total', 'total'],
    }
    if (not stats):
        filemap = self.status('c:{0}:b:{1}:f:backup_stats\n'.format(client, number), agent=agent)
    else:
        filemap = stats
    for line in filemap:
        if ((line == '-list begin-') or (line == '-list end-')):
            continue
        (key, val) = line.split(':')
        if ((backup['windows'] == 'unknown') and (key == 'client_is_windows')):
            if (val == '1'):
                backup['windows'] = 'true'
            else:
                backup['windows'] = 'false'
            continue
        if (key not in keys):
            continue
        ckey = keys[key]
        if isinstance(ckey, list):
            if (ckey[0] not in backup):
                backup[ckey[0]] = {
                    
                }
            backup[ckey[0]][ckey[1]] = int(val)
        else:
            backup[ckey] = int(val)
    return backup

dataset/ETHPy150Open ziirish/burp-ui/burpui/misc/backend/burp1.py Burp._parse_backup_stats/original