#!/usr/bin/python """dump CMMapP and CMMapG files from \ConnMgr\ from Windows PocketPC devices""" import sys, os, struct format = '{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}' if len(sys.argv) >= 3: # specify Firefox-added version number as 2nd arg nametemplate = 'CMMap%s(%d)' % ('%s', int(sys.argv[2])) else: nametemplate = 'CMMap%s' if sys.argv[1]: dir = sys.argv[1] else: dir = '.' for suffix in 'PG': file = open(os.path.join(dir, nametemplate % suffix), 'rb') if suffix == 'P': patterns = file.read().decode('utf-16').split('\0') # 'P' for Patterns else: guids = file.read() # 'G' for GUIDs file.close print '' print '' for index in range(0, len(guids), 20): # I'm not sure "priority" is a good name for this... don't know what it's for! # update: it's not a bad name... M$ calls it "index" but it's a priority index. # lower numbers get processed first (match URL to pattern), so more specific # entries should have lower numbers. # HOWEVER: now the default entries are between 1000 and 1500, so all the old # defaults are higher than that, e.g. 536880911 (0x1fffffff). To give # preference to your new entry, use 999 or below. # Microsoft reserves 500 and below, so avoid those if possible. priority = struct.unpack(' """ % (priority, '%08x' % priority, patterns[index / 20], network) print '' print ''