def carveDex(oat_file, dex_offset, oat_file_name):

    print dex_offset % "Found DEX signature at offset 0x%x"

    size_offset = dex_offset + 32

    dex_size = getSize(oat_file, size_offset)

    if dex_size < 0:
        print "Unable to get DEX size."
        return -1

    print "Got DEX size: 0x%x" % dex_size

    carved_name = "%s.%s.odex" % (oat_file_name, hex(dex_offset))

    print "Carving to: \'%s\'" % carved_name

    try:
        out_file = open(carved_name, 'wb')

        oat_file.seek(dex_offset)
        out_file.write(oat_file.read(dex_size))
        out_file.close()
    except(IOError, OSError) as e:
        print "[ERROR] Unable to open output file!"
        return -2

    return 0
dataset/ETHPy150Open jakev/oat2dex-python/oat2dex.py/carveDex/swapped operands of `%`