1

I found this very helpful information about Verity database structure .ddd file - Verity Documentum?

Now I want to migrate an old Verity database to a new application, therefore I'd like to dump everything into a text file and parse it with a small tool. Unfortunately, with browse.exe I seem only to be able to see an entry at a time, is there any way to dump everything to standard output in one go?

2
  • have you tried 7-zip
    – alecxs
    Jul 31, 2020 at 14:56
  • no, it's not an archive, it's a Verity database file.
    – Scorp
    Aug 1, 2020 at 15:05

1 Answer 1

1

I found a solution. It's not the best, but at least, it's something usable:

import argparse
import json
import os
import re
import subprocess

parser = argparse.ArgumentParser(description='Dump MTL Verity ddd file into a text file')
parser.add_argument('input', metavar='DDD-FILE', nargs='+', help='MTL ddd input files')
parser.add_argument('-o','--output', metavar='JSON-FILE', help='JSON output file', required=True)
parser.add_argument('--browse-tool', metavar='TOOL', help='The browse tool to use', default='browse.exe')
args = parser.parse_args()

reNumEntries = re.compile('.*There are \(([0-9]+)\) entries in the field \(VdkVgwKey\).*')
reEntry = re.compile('[0-9]+ ([A-Za-z_0-9]+)[^=]+= (.*)')
reBadName = re.compile('.*_(IX|MI|MX|OF|SZ)')
reBadValue = re.compile('\(only [0-9]+ records\)')

def dump_ddd(ddd_file):
    print('Dumping file {}'.format(ddd_file))
    dump_cmd = [args.browse_tool, ddd_file]
    with subprocess.Popen(dump_cmd, stdout = subprocess.PIPE, stdin = subprocess.PIPE) as proc:
        proc.stdin.write(b'_\nc\nVdkVgwKey\n')
        proc.stdin.flush()
        numEntries = 0
        for line in proc.stdout:
            match = reNumEntries.match(line.decode('ascii'))
            if match:
                numEntries = int(match.group(1))
                break
        print('Found {} entries!'.format(numEntries))
        inputStr = '\n'.join(str(i) for i in range(0, numEntries)) + '\n'
        proc.stdin.write(inputStr.encode('ascii'))
        proc.stdin.write(b'q\n')
        proc.stdin.flush()
        output, _ = proc.communicate(timeout=60)
        data = []
        entry = {}
        for line in output.decode('ascii').split('\n'):
            match = reEntry.match(line)
            if match:
                name = match.group(1)
                if reBadName.match(name):
                    continue
                if name == 'VdkVgwKey':
                    if entry:
                        data.append(entry)
                        entry = {}
                        continue
                value = match.group(2)
                if reBadValue.match(value):
                    value = str()
                entry[name] = value
        if entry:
            data.append(entry)
        return data

collection = []
for ddd_file in args.input:
    collection += dump_ddd(ddd_file)
    
with open(args.output, 'w') as json_file:
    json.dump(collection, json_file, indent=2)
print('Data written to the file {}'.format(args.output))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .