Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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))
# 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))
# 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))
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))
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))
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))
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))
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))