def get_local_gpt(sid): ''' Convert default policy to GPT and create object out of it. ''' log('D25') lp2gpt() local_policy = gpt(str(local_policy_cache()), sid) local_policy.set_name('Local Policy') return local_policy
def get_local_gpt(sid): ''' Convert default policy to GPT and create object out of it. ''' logging.debug(slogm('Re-caching Local Policy')) lp2gpt() local_policy = gpt(str(local_policy_cache()), sid) local_policy.set_name('Local Policy') return local_policy
def lp2gpt(): ''' Convert local-policy to full-featured GPT. ''' lppath = os.path.join(default_policy_path(), 'Machine/Registry.pol.xml') # Load settings from XML PolFile polparser = GPPolParser() polfile = util.preg.load_preg(lppath) polparser.pol_file = polfile # Create target default policy directory if missing destdir = os.path.join(local_policy_cache(), 'Machine') os.makedirs(destdir, exist_ok=True) # Write PReg polparser.write_binary(os.path.join(destdir, 'Registry.pol'))