#!/usr/bin/python # # tool to manipulate a remote registry # Copyright Andrew Tridgell 2005 # Copyright Jelmer Vernooij 2007 # Released under the GNU GPL v3 or later # import sys options = GetOptions(ARGV, "POPT_AUTOHELP", "POPT_COMMON_SAMBA", "POPT_COMMON_CREDENTIALS", "createkey=s") if (options == undefined) { print "Failed to parse options" sys.exit(-1) if len(sys.argv < 2: print "Usage: %s [path]" % sys.argv[0] sys.exit(-1) binding = options.ARGV[0] reg = winregObj() print "Connecting to " + binding status = reg.connect(binding) if (status.is_ok != true) { print("Failed to connect to " + binding + " - " + status.errstr + "\n") return -1 } def list_values(path): list = reg.enum_values(path) if (list == undefined) { return } for (i=0;i 2: root = sys.argv[2] else: root = '' if options.createkey: try: reg.create_key("HKLM\\SOFTWARE", options.createkey) except: print "Failed to create key" else: printf("Listing registry tree '%s'\n", root) count = list_path(root) if count == 0: println("No entries found") sys.exit(1)