Beispiel #1
0
    def generator(self, data):
        for reg, key in data:
            if key:
                subkeys = list(rawreg.subkeys(key))
                values = list(rawreg.values(key))
                yield (0, [
                    str("{0}".format(reg)),
                    str("{0}".format(key.Name)),
                    str("{0:3s}".format(self.voltext(key))),
                    str("{0}".format(key.LastWriteTime)), "-", "-", "-", "-",
                    "-", "-"
                ])

                if subkeys:
                    for s in subkeys:
                        if s.Name == None:
                            yield (0, [
                                str("{0}".format(reg)),
                                str("{0}".format(key.Name)),
                                str("{0:3s}".format(self.voltext(key))),
                                str("{0}".format(key.LastWriteTime)),
                                str("Unknown subkey: {0}".format(
                                    s.Name.reason)), "-", "-", "-", "-", "-"
                            ])
                        else:
                            yield (0, [
                                str("{0}".format(reg)),
                                str("{0}".format(key.Name)),
                                str("{0:3s}".format(self.voltext(key))),
                                str("{0}".format(key.LastWriteTime)),
                                str("{0}".format(s.Name)),
                                str("{0:3s}".format(self.voltext(s))), "-",
                                "-", "-", "-"
                            ])

                if values:
                    for v in values:
                        tp, dat = rawreg.value_data(v)
                        if tp == 'REG_BINARY' or tp == 'REG_NONE':
                            dat = Bytes(dat)
                        if tp in ['REG_SZ', 'REG_EXPAND_SZ', 'REG_LINK']:
                            dat = dat.encode("ascii", 'backslashreplace')
                        if tp == 'REG_MULTI_SZ':
                            for i in range(len(dat)):
                                dat[i] = dat[i].encode("ascii",
                                                       'backslashreplace')
                        yield (0, [
                            str("{0}".format(reg)),
                            str("{0}".format(key.Name)),
                            str("{0:3s}".format(self.voltext(key))),
                            str("{0}".format(key.LastWriteTime)), "-", "-",
                            str(tp),
                            str("{0}".format(v.Name)),
                            str("{0:3s}".format(self.voltext(v))),
                            str(dat)
                        ])
Beispiel #2
0
    def generator(self, data):
        for reg, key in data:
            if key:
                subkeys = list(rawreg.subkeys(key))
                values = list(rawreg.values(key))
                yield (
                    0,
                    [
                        f"{reg}",
                        f"{key.Name}",
                        f"{self.voltext(key):3s}",
                        f"{key.LastWriteTime}",
                        "-",
                        "-",
                        "-",
                        "-",
                        "-",
                        "-",
                    ],
                )

                if subkeys:
                    for s in subkeys:
                        if s.Name == None:
                            yield (
                                0,
                                [
                                    f"{reg}",
                                    f"{key.Name}",
                                    f"{self.voltext(key):3s}",
                                    f"{key.LastWriteTime}",
                                    f"Unknown subkey: {s.Name.reason}",
                                    "-",
                                    "-",
                                    "-",
                                    "-",
                                    "-",
                                ],
                            )
                        else:
                            yield (
                                0,
                                [
                                    f"{reg}",
                                    f"{key.Name}",
                                    f"{self.voltext(key):3s}",
                                    f"{key.LastWriteTime}",
                                    f"{s.Name}",
                                    f"{self.voltext(s):3s}",
                                    "-",
                                    "-",
                                    "-",
                                    "-",
                                ],
                            )

                if values:
                    for v in values:
                        tp, dat = rawreg.value_data(v)
                        if tp == 'REG_BINARY' or tp == 'REG_NONE':
                            dat = Bytes(dat)
                        if tp in ['REG_SZ', 'REG_EXPAND_SZ', 'REG_LINK']:
                            dat = dat.encode("ascii", 'backslashreplace')
                        if tp == 'REG_MULTI_SZ':
                            for i in range(len(dat)):
                                dat[i] = dat[i].encode("ascii",
                                                       'backslashreplace')
                        yield (
                            0,
                            [
                                f"{reg}",
                                f"{key.Name}",
                                f"{self.voltext(key):3s}",
                                f"{key.LastWriteTime}",
                                "-",
                                "-",
                                f"{tp}",
                                f"{v.Name}",
                                f"{self.voltext(v):3s}",
                                f"{dat}",
                            ],
                        )
Beispiel #3
0
    def generator(self, data):
        for reg, key in data:
            if key:
                subkeys = list(rawreg.subkeys(key))
                values = list(rawreg.values(key))
                yield (0, [str("{0}".format(reg)), 
                        str("{0}".format(key.Name)),
                        str("{0:3s}".format(self.voltext(key))),
                        str("{0}".format(key.LastWriteTime)),
                        "-",
                        "-",
                        "-",
                        "-",
                        "-",
                        "-"])

                if subkeys:
                    for s in subkeys:
                        if s.Name == None:
                            yield (0, [str("{0}".format(reg)),
                                str("{0}".format(key.Name)),
                                str("{0:3s}".format(self.voltext(key))),
                                str("{0}".format(key.LastWriteTime)),
                                str("Unknown subkey: {0}".format(s.Name.reason)),
                                "-",
                                "-",
                                "-",
                                "-",
                                "-"])
                        else:
                            yield (0, [str("{0}".format(reg)),
                                str("{0}".format(key.Name)),
                                str("{0:3s}".format(self.voltext(key))),
                                str("{0}".format(key.LastWriteTime)),
                                str("{0}".format(s.Name)), 
                                str("{0:3s}".format(self.voltext(s))),
                                "-",
                                "-",
                                "-",
                                "-"])

                if values:
                    for v in values:
                        tp, dat = rawreg.value_data(v)
                        if tp == 'REG_BINARY' or tp == 'REG_NONE':
                            dat = Bytes(dat)
                        if tp in ['REG_SZ', 'REG_EXPAND_SZ', 'REG_LINK']:
                            dat = dat.encode("ascii", 'backslashreplace')
                        if tp == 'REG_MULTI_SZ':
                            for i in range(len(dat)):
                                dat[i] = dat[i].encode("ascii", 'backslashreplace')
                        yield (0, [str("{0}".format(reg)),
                            str("{0}".format(key.Name)),
                            str("{0:3s}".format(self.voltext(key))),
                            str("{0}".format(key.LastWriteTime)),
                            "-",
                            "-",
                            str(tp),
                            str("{0}".format(v.Name)),
                            str("{0:3s}".format(self.voltext(v))),
                            str(dat)])