parseapk/parse_apk.py
def parse_eocd(data, offset):
    '''Parses End of Central Directory structure in ZIP file
    data = content of the entire APK
    offset = offset to the beginning of EOCD
    '''
    print "\033[1;33;1m---------------- End of Central Directory ------------"
    print "Offset: %d (0x%08x)" % (offset, offset)
    eocd = data[offset:]
    signature = eocd[0:4]
    #print "Tag : ", signature
    disk_number = struct.unpack("<H", eocd[4:6])[0]
    start_disk_number = struct.unpack("<H", eocd[6:8])[0]
    entries_on_disk =  struct.unpack("<H", eocd[8:10])[0]
    entries_in_directory = struct.unpack("<H", eocd[10:12])[0]
    print "Entries in directory        = %d" % (entries_in_directory)
    directory_size = struct.unpack("<L", eocd[12:16])[0]
    print "Directory size              = %d" % (directory_size)
    directory_offset = struct.unpack("<L", eocd[16:20])[0]
    print "Offset to Central Directory = %d (0x%08x)" % (directory_offset, directory_offset)
    comment_length = struct.unpack("<h", eocd[20:22])[0]
    print "Comment length              = %d" % (comment_length)
    comment = eocd[22:22+comment_length]
    print "Comment: %s" % (comment)
    print "\033[0m"
    return directory_offset
Parses End of Central Directory structure in ZIP file
    data = content of the entire APK
    offset = offset to the beginning of EOCD
    
Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD
Parses End of Central Directory structure in ZIP file data = content of the entire APK offset = offset to the beginning of EOCD
def parse_eocd(data, offset):
    print "\033[1;33;1m---------------- End of Central Directory ------------"
    print "Offset: %d (0x%08x)" % (offset, offset)
    eocd = data[offset:]
    signature = eocd[0:4]
    disk_number = struct.unpack("<H", eocd[4:6])[0]
    start_disk_number = struct.unpack("<H", eocd[6:8])[0]
    entries_on_disk =  struct.unpack("<H", eocd[8:10])[0]
    entries_in_directory = struct.unpack("<H", eocd[10:12])[0]
    print "Entries in directory        = %d" % (entries_in_directory)
    directory_size = struct.unpack("<L", eocd[12:16])[0]
    print "Directory size              = %d" % (directory_size)
    directory_offset = struct.unpack("<L", eocd[16:20])[0]
    print "Offset to Central Directory = %d (0x%08x)" % (directory_offset, directory_offset)
    comment_length = struct.unpack("<h", eocd[20:22])[0]
    print "Comment length              = %d" % (comment_length)
    comment = eocd[22:22+comment_length]
    print "Comment: %s" % (comment)
    print "\033[0m"
    return directory_offset
def parse_eocd ( data , offset ) : print "\033[1;33;1m---------------- End of Central Directory ------------" print "Offset: %d (0x%08x)" % ( offset , offset ) eocd = data [ offset : ] signature = eocd [ 0 : 4 ] disk_number = struct . unpack ( "<H" , eocd [ 4 : 6 ] ) [ 0 ] start_disk_number = struct . unpack ( "<H" , eocd [ 6 : 8 ] ) [ 0 ] entries_on_disk = struct . unpack ( "<H" , eocd [ 8 : 10 ] ) [ 0 ] entries_in_directory = struct . unpack ( "<H" , eocd [ 10 : 12 ] ) [ 0 ] print "Entries in directory        = %d" % ( entries_in_directory ) directory_size = struct . unpack ( "<L" , eocd [ 12 : 16 ] ) [ 0 ] print "Directory size              = %d" % ( directory_size ) directory_offset = struct . unpack ( "<L" , eocd [ 16 : 20 ] ) [ 0 ] print "Offset to Central Directory = %d (0x%08x)" % ( directory_offset , directory_offset ) comment_length = struct . unpack ( "<h" , eocd [ 20 : 22 ] ) [ 0 ] print "Comment length              = %d" % ( comment_length ) comment = eocd [ 22 : 22 + comment_length ] print "Comment: %s" % ( comment ) print "\033[0m" return directory_offset
Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD
Parses End of Central Directory structure in ZIP file data = content of the entire APK offset = offset to the beginning of EOCD
'''Parses End of Central Directory structure in ZIP file
    data = content of the entire APK
    offset = offset to the beginning of EOCD
    ''' #print "Tag : ", signature
data
offset