Exemplo n.º 1
0
    def __init__(self, cd_item, parent=None):
        super(ClassDefinitionItemView, self).__init__(parent)
        self._cd_item = cd_item

        try:
            txt = dump_layout(cd_item.cd, cd_item.cl)
        except:
            txt = traceback.format_exc()
        self.addTab(FixedWidthTextView(txt), "Class details")

        # TODO: hack get_parsers() until we have a unified repo/config
        vv = VstructViewWidget(get_parsers(), self._cd_item.structs, self._cd_item.data)
        self.addTab(vv, "Structures")

        hv = HexViewWidget(self._cd_item.data)
        self.addTab(hv, "Hex view")
Exemplo n.º 2
0
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)

    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
    print(cd.tree())
    cl = o.get_cl(namespaceName, className)
    print(cl.derivation)
    try:
        print(dump_layout(cd, cl))
    except:
        print("ERROR: failed to dump class definition!")
        print(traceback.format_exc())