获取ipa文件内的所有图片素材
来源:互联网 发布:java源代码下载网站 编辑:程序博客网 时间:2024/04/28 06:21
将所需的ipa文件下载到PC上,将后缀名改为zip
第二步:
将zip解压缩后,有一个Payload文件夹,该文件夹下有一个app文件
第三步:
右键该app文件,选择显示包内容
第四步:
将所需的png图片文件全部copy出来,放在一个新建的文件夹中
注:该文件夹路径最好是全英文
第五步:
ipin.py 下载
将ipin.py文件放入刚刚那个新建的文件夹中第六步:
运行终端,先找到该新建文件夹
第七步:
输入 python ipin.py 回车
回答 Y
第八步:
你可以看到,你新建文件夹中原来不能预览的png图片现在已经全部可以正常显示了
使用方法:
1、把ipin.py放到要恢复的.png图片一个目录里
2、打开终端,cd到此目录。
3、输入 python ipin.py
4、根据提示信息输入 Y,回车。这样就能把图片还原到可以查看了。
/**ipin.py**/
#---
# iPIN - iPhone PNG Images Normalizer v1.0
# Copyright (C) 2007
#
# Author:
# Axel E. Brzostowski
# http://www.axelbrz.com.ar/
# axelbrz@gmail.com
#
# References:
# http://iphone.fiveforty.net/wiki/index.php/PNG_Images
# http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#---
from structimport *
from zlib import *
import stat
import sys
import os
def getNormalizedPNG(filename):
pngheader = "\x89PNG\r\n\x1a\n"
file = open(filename,"rb")
oldPNG = file.read()
file.close()
if oldPNG[:8] != pngheader:
return None
newPNG = oldPNG[:8]
chunkPos = len(newPNG)
# For each chunk in the PNG file
while chunkPos < len(oldPNG):
# Reading chunk
chunkLength = oldPNG[chunkPos:chunkPos+4]
chunkLength = unpack(">L", chunkLength)[0]
chunkType = oldPNG[chunkPos+4 : chunkPos+8]
chunkData = oldPNG[chunkPos+8:chunkPos+8+chunkLength]
chunkCRC = oldPNG[chunkPos+chunkLength+8:chunkPos+chunkLength+12]
chunkCRC = unpack(">L", chunkCRC)[0]
chunkPos += chunkLength +12
# Parsing the header chunk
if chunkType =="IHDR":
width = unpack(">L", chunkData[0:4])[0]
height = unpack(">L", chunkData[4:8])[0]
# Parsing the image chunk
if chunkType =="IDAT":
try:
# Uncompressing the image chunk
bufSize = width * height *4 + height
chunkData = decompress( chunkData,-8, bufSize)
except Exception, e:
# The PNG image is normalized
returnNone
# Swapping red & blue bytes for each pixel
newdata =""
for yin xrange(height):
i = len(newdata)
newdata += chunkData[i]
for xin xrange(width):
i = len(newdata)
newdata += chunkData[i+2]
newdata += chunkData[i+1]
newdata += chunkData[i+0]
newdata += chunkData[i+3]
# Compressing the image chunk
chunkData = newdata
chunkData = compress( chunkData )
chunkLength = len( chunkData )
chunkCRC = crc32(chunkType)
chunkCRC = crc32(chunkData, chunkCRC)
chunkCRC = (chunkCRC +0x100000000) %0x100000000
# Removing CgBI chunk
if chunkType !="CgBI":
newPNG += pack(">L", chunkLength)
newPNG += chunkType
if chunkLength >0:
newPNG += chunkData
newPNG += pack(">L", chunkCRC)
# Stopping the PNG file parsing
if chunkType =="IEND":
break
return newPNG
def updatePNG(filename):
data = getNormalizedPNG(filename)
if data !=None:
file = open(filename,"wb")
file.write(data)
file.close()
return True
return data
def getFiles(base):
global _dirs
global _pngs
if base ==".":
_dirs = []
_pngs = []
if basein _dirs:
return
files = os.listdir(base)
for filein files:
filepath = os.path.join(base, file)
try:
st = os.lstat(filepath)
except os.error:
continue
if stat.S_ISDIR(st.st_mode):
ifnot filepathin _dirs:
getFiles(filepath)
_dirs.append( filepath )
elif file[-4:].lower() ==".png":
ifnot filepathin _pngs:
_pngs.append( filepath )
if base ==".":
return _dirs, _pngs
print "-----------------------------------"
print " iPhone PNG Images Normalizer v1.0"
print "-----------------------------------"
print " "
print "[+] Searching PNG files...",
dirs, pngs = getFiles(".")
print "ok"
if len(pngs) ==0:
print" "
print"[!] Alert: There are no PNG files found. Move this python file to the folder that contains the PNG files to normalize."
exit()
print " "
print " - %d PNG files were found at this folder (and subfolders)." % len(pngs)
print " "
while True:
normalize = raw_input("[?] Do you want to normalize all images (Y/N)? ").lower()
if len(normalize) >0 and (normalize[0] =="y"or normalize[0] =="n"):
break
normalized =0
if normalize[0] =="y":
for ipngin xrange(len(pngs)):
perc = (float(ipng) / len(pngs)) *100.0
print"%.2f%% %s" % (perc, pngs[ipng])
if updatePNG(pngs[ipng]):
normalized +=1
print " "
print "[+] %d PNG files were normalized." % normalized
- 获取ipa文件内的所有图片素材
- 获取ipa文件内的所有图片素材
- 1. 获取ipa文件内的所有图片素材
- Java获取一个文件夹内的所有文件(包括所有子文件夹内的)
- 获取文件夹内所有指定后缀的文件
- java获取某个文件夹内所有文件的名称
- 【C++】获取当前文件夹内的所有文件
- 使用_finddata_t获取文件夹内所有文件
- PHP递归获取目录内所有文件
- 如何内测IOS应用的ipa文件
- PHP获取文件夹内所有文件包括子目录文件的名称或路径
- PHP获取文件夹内所有文件包括子目录文件的名称或路径
- 获取局域网内所有的数据库实例
- Oracle 获取时间段内的所有周
- 获取手机内的所有应用列表
- 如何完全抓取出ipa包内的所有图片资源
- MAC XCode 获取编译好的ipa文件步骤
- 从砸壳后的ipa中获取头文件信息
- Activity停止的时候,取消部分未完成的网络请求
- 代码托管及版本控制是选择Github还是Bitbucket?
- UVALive 6661 - Equal Sum Sets (类似硬币的DP问题)
- Activity停止的时候,取消部分未完成的网络请求
- Collections.sort 用法 比较器comparator
- 获取ipa文件内的所有图片素材
- POJ 1260 Pearls (动规)
- 【C++漫谈】const杂谈
- asp.net模板页的各种使用技巧
- 多舒服撒打开了非就
- POJ 2386
- Nginx学习之十-超时管理(定时器事件)
- ASP.NET MVC之验证终结者篇
- HOJ 2634 网络流 【蕴含式最大获利问题】