parseapk/parse_apk.py
def parse_file(data, offset):
    '''
    parses Local File Header structure for ZIP file
    data = content of entire APK
    offset = offset to the beginning of Local File Header
    '''
    print "------------- Local File Header -------------------"
    print "Offset: %d (0x%08x)" % (offset, offset)
    lfh = data[offset:]
    signature = lfh[0:4]
    version_needed = struct.unpack("<H", lfh[4:6])[0]
    print "Version needed   : ", version_needed
    compressed_size = struct.unpack("<L", lfh[18:22])[0]
    print "Compressed size  : ", compressed_size
    uncompressed_size = struct.unpack("<L", lfh[22:26])[0]
    print "Uncompressed size: ", uncompressed_size
    filename_length = struct.unpack("<H", lfh[26:28])[0]
    extrafield_length = struct.unpack("<H", lfh[28:30])[0]
    filename = lfh[30:30+filename_length]
    print "Filename: ", filename
    
    # file data should be placed immediately after local header

    parses Local File Header structure for ZIP file
    data = content of entire APK
    offset = offset to the beginning of Local File Header
    
parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header
parses Local File Header structure for ZIP file data = content of entire APK offset = offset to the beginning of Local File Header
def parse_file(data, offset):
    print "------------- Local File Header -------------------"
    print "Offset: %d (0x%08x)" % (offset, offset)
    lfh = data[offset:]
    signature = lfh[0:4]
    version_needed = struct.unpack("<H", lfh[4:6])[0]
    print "Version needed   : ", version_needed
    compressed_size = struct.unpack("<L", lfh[18:22])[0]
    print "Compressed size  : ", compressed_size
    uncompressed_size = struct.unpack("<L", lfh[22:26])[0]
    print "Uncompressed size: ", uncompressed_size
    filename_length = struct.unpack("<H", lfh[26:28])[0]
    extrafield_length = struct.unpack("<H", lfh[28:30])[0]
    filename = lfh[30:30+filename_length]
    print "Filename: ", filename
def parse_file ( data , offset ) : print "------------- Local File Header -------------------" print "Offset: %d (0x%08x)" % ( offset , offset ) lfh = data [ offset : ] signature = lfh [ 0 : 4 ] version_needed = struct . unpack ( "<H" , lfh [ 4 : 6 ] ) [ 0 ] print "Version needed   : " , version_needed compressed_size = struct . unpack ( "<L" , lfh [ 18 : 22 ] ) [ 0 ] print "Compressed size  : " , compressed_size uncompressed_size = struct . unpack ( "<L" , lfh [ 22 : 26 ] ) [ 0 ] print "Uncompressed size: " , uncompressed_size filename_length = struct . unpack ( "<H" , lfh [ 26 : 28 ] ) [ 0 ] extrafield_length = struct . unpack ( "<H" , lfh [ 28 : 30 ] ) [ 0 ] filename = lfh [ 30 : 30 + filename_length ] print "Filename: " , filename
parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header
parses Local File Header structure for ZIP file data = content of entire APK offset = offset to the beginning of Local File Header
'''
    parses Local File Header structure for ZIP file
    data = content of entire APK
    offset = offset to the beginning of Local File Header
    ''' # file data should be placed immediately after local header
data
offset