def main(type_, path, namespaceName, className): if type_ not in ("xp", "win7"): raise RuntimeError("Invalid mapping type: {:s}".format(type_)) c = CIM(type_, path) i = Index(c.cim_type, c.logical_index_store) o = ObjectResolver(c, i) while className != "": print("%s" % "=" * 80) print("namespace: %s" % namespaceName) try: cd = o.get_cd(namespaceName, className) except IndexError: print("ERROR: failed to find requested class definition") return cl = o.get_cl(namespaceName, className) try: print(dump_definition(cd, cl)) except: print("ERROR: failed to dump class definition!") print(traceback.format_exc()) className = cd.super_class_name
def main(type_, path): logging.basicConfig(level=logging.INFO) if type_ not in ("xp", "win7"): raise RuntimeError("Invalid mapping type: {:s}".format(type_)) c = CIM(type_, path) index = Index(c.cim_type, c.logical_index_store) object_resolver = ObjectResolver(c, index) ctx = Context(c, index, object_resolver) app = QApplication(sys.argv) screen = CimUiForm(ctx) screen.show() sys.exit(app.exec_())
def main(type_, path, namespaceName, className, key_specifier=None): if type_ not in ("xp", "win7"): raise RuntimeError("Invalid mapping type: {:s}".format(type_)) c = CIM(type_, path) index = Index(c.cim_type, c.logical_index_store) o = ObjectResolver(c, index) cd = o.get_cd(namespaceName, className) cl = o.get_cl(namespaceName, className) instances = [] if key_specifier: key_values = key_specifier.split(",") key = InstanceKey() for key_value in key_values: if "=" not in key_value: raise RuntimeError("Invalid key specifier: " + str(key_value)) k, _, v = key_value.partition("=") key[k] = v print(str(key)) ci = o.get_ci(namespaceName, className, key) instances.append(ci) else: for instance in o.get_cd_children_ci(namespaceName, className): ci = o.get_ci(namespaceName, className, instance.instance_key) instances.append(ci) for instance in instances: print("%s" % "=" * 80) #print(compute_instance_hash(index, instance)) try: print( dump_instance(instance, encoding='ascii', encoding_errors='ignore')) except: print("ERROR: failed to dump class instance!") print(traceback.format_exc())
def main(type_, path, namespaceName, className, key_specifier=None): if type_ not in ("xp", "win7"): raise RuntimeError("Invalid mapping type: {:s}".format(type_)) c = CIM(type_, path) index = Index(c.cim_type, c.logical_index_store) o = ObjectResolver(c, index) cd = o.get_cd(namespaceName, className) cl = o.get_cl(namespaceName, className) instances = [] if key_specifier: key_values = key_specifier.split(",") key = InstanceKey() for key_value in key_values: if "=" not in key_value: raise RuntimeError("Invalid key specifier: " + str(key_value)) k, _, v = key_value.partition("=") key[k] = v print(str(key)) ci = o.get_ci(namespaceName, className, key) instances.append(ci) else: for instance in o.get_cd_children_ci(namespaceName, className): ci = o.get_ci(namespaceName, className, instance.instance_key) instances.append(ci) for instance in instances: print("%s" % "=" * 80) #print(compute_instance_hash(index, instance)) try: print(dump_instance(instance)) except: print("ERROR: failed to dump class instance!") print(traceback.format_exc())