How to use the apkutils.dex.dexparser.SizeOff function in apkutils

To help you get started, we’ve selected a few apkutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
# magic_vers = stream.read(4)  # magic_vers
        # checksum = stream.u32()  # adler32 checksum
        # import binascii
        # sha1 = binascii.b2a_hex(stream.read(20)).decode('utf-8')
        stream.read(32)  # skip 32(magic, magic_vers, checksum, sha1)

        if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
# sha1 = binascii.b2a_hex(stream.read(20)).decode('utf-8')
        stream.read(32)  # skip 32(magic, magic_vers, checksum, sha1)

        if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
# import binascii
        # sha1 = binascii.b2a_hex(stream.read(20)).decode('utf-8')
        stream.read(32)  # skip 32(magic, magic_vers, checksum, sha1)

        if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
stream.read(32)  # skip 32(magic, magic_vers, checksum, sha1)

        if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))
github mikusjelly / apkutils / apkutils / dex / dexparser.py View on Github external
if stream.u32() != len(self.raw):
            print('Warning, unexpected file size!')

        if stream.u32() != 0x70:
            print('Warning, unexpected header size!')

        if stream.u32() != 0x12345678:
            print('Warning, unexpected endianess tag!')

        self.link = SizeOff(stream)
        self.map_off = stream.u32()
        self.string_ids = SizeOff(stream)
        self.type_ids = SizeOff(stream)
        self.proto_ids = SizeOff(stream)
        self.field_ids = SizeOff(stream)
        self.method_ids = SizeOff(stream)
        self.class_defs = SizeOff(stream)
        self.data = SizeOff(stream)

        if flag:  # parse dex class
            defs = self.class_defs
            self.classes = []
            for i in range(defs.size):
                self.classes.append(DexClass(self, defs.off, i))