ApkTool反编译《新浪微博》《万能钥匙》android a

1、需要的材料

  1. ApkTool.jar
  2. ApkTool.bat
  3. aapt.exe  
  4. 签名工具
  5. 万能钥匙apk安装包

apktool下载地址:https://code.google.com/p/android-apktool/  必须下载最新的!

2、反编译万能钥匙

将apktool.jar 、apktool.bat 、aapt.exe 、wannengyaoshi.apk放在同一目录下。

1、反编译:在目录下打开cmd,输入apktool d wannengyaoshi.apk。将会在此目录生成wannengyaoshi文件夹。

这里提示了两个worning。

W: Cant find 9patch chunk in file: "drawable-xhdpi/ic_indication_white.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/sc_overlay_start.9.png". Renaming it to *.png.

这里非常关键,意思是图片为.9.png,却没有黑块,于是强行去掉了.9后缀,黑块指的是

例如:(这是我自己做的正常的.9图片,并不是万能钥匙里的。)上下左右四条边上的黑线,这是9png图片特有的东西。

让我们看看反编译后的图片

sc_overlay_start.png


去掉了.9的后缀,并且没有发现黑线。先不管这两个worning。

2、修改:进入生成后的wannengyaoshi目录,修改res/walue/string.xml改变应用名称“大便”。
3、回编译:在目录下打开cmd,输入apktool b wannengyaoshi。将会在wannengyaoshi/dis/下生成未签名的apk。

这里将会出现问题

D:\wannengyaoshi\res\drawable-xhdpi\ic_indication_white.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
D:\wannengyaoshi\res\drawable-hdpi\sc_overlay_start.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
D:\wannengyaoshi\res\values\styles.xml:975: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Holo.Dialog.Alert'.

显然是这三个文件有问题。前两个是图片无法编译,第三个是xml错误。

图片的问题,上面已经提及到了,解决方法是,替换这两张图片,或者重新制作。

xml的问题,找到相应行,改为Theme.AppCompat.Dialog即可。

其实这两个问题,在eclipse下编译完全可以通过。但是apktool是不允许的。

为什么图片会没有黑线?因为开发者用特殊软件去掉了,强行骗我们,这不是.9


4、打开APKSign.exe进行签名,随便一个签名文件都可以。(不签名无法安装)

大功告成,安装后看看名称是否为大便?哈哈哈哈



-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


下面让我反编译新浪微博,提前说,回编译之后只能打开第一个启动页,然后会崩溃,目测是和签名有关系,毕竟我们没有新浪微博真正的签名文件。

第一第二步相同,你会发现worning的变多了。

W: Cant find 9patch chunk in file: "drawable-xhdpi/messages_queue_state_failed.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/empty_button_highlighted.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-xhdpi/import_video_time.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-xhdpi/messages_queue_state_failed_highlighted.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-xhdpi/empty_button_highlighted.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/messages_queue_state_failed_highlighted.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/empty_button.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/messages_queue_state_failed.9.png". Renaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-xhdpi/empty_button.9.png". Renaming it to *.png.
此时执行第三步之前,替换以上文件已经不管用了,会出现一种新的错误,例如

D:\ApkTool\apktool\sina\res\values\public.xml:932: error: Public symbol drawable/widget_btn_up declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:804: error: Public symbol drawable/widget_btn_up_d declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:933: error: Public symbol drawable/widget_btn_up_sel declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:805: error: Public symbol drawable/widget_edit_block_bg declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:806: error: Public symbol drawable/widget_edit_block_bg_normal declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:934: error: Public symbol drawable/widget_edit_block_bg_selected declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:807: error: Public symbol drawable/widget_edit_icon declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:935: error: Public symbol drawable/widget_edit_icon_normal declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:936: error: Public symbol drawable/widget_edit_icon_selected declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2988: error: Public symbol drawable/widget_head_mask declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2989: error: Public symbol drawable/widget_icon_picture declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2990: error: Public symbol drawable/widget_icon_play declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2991: error: Public symbol drawable/widget_icon_refresh declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2992: error: Public symbol drawable/widget_icon_refresh_highlighted declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2993: error: Public symbol drawable/widget_icon_write declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2994: error: Public symbol drawable/widget_icon_write_highlighted declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2995: error: Public symbol drawable/widget_left declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2996: error: Public symbol drawable/widget_left_highlighted declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:937: error: Public symbol drawable/widget_line declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2997: error: Public symbol drawable/widget_list declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:938: error: Public symbol drawable/widget_logo declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:808: error: Public symbol drawable/widget_logo_btn declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:939: error: Public symbol drawable/widget_logo_selected declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2998: error: Public symbol drawable/widget_middle declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:2999: error: Public symbol drawable/widget_middle_highlighted declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3179: error: Public symbol drawable/widget_preview declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3000: error: Public symbol drawable/widget_right declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3001: error: Public symbol drawable/widget_right_highlighted declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3002: error: Public symbol drawable/widget_top declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3003: error: Public symbol drawable/widget_top_shadow declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3180: error: Public symbol drawable/widgets_icon_info declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3181: error: Public symbol drawable/widgets_icon_logo declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:3004: error: Public symbol drawable/widgets_image_default declared here is not defined.
D:\ApkTool\apktool\sina\res\values\public.xml:809: error: Public symbol drawable/yw_1222 declared here is not defined.
好多好多

没办法,只有把所有图片都替换了,但是有4000多个文件,怎么办?

这里我写了个小程序

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;


public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ReadAllFile("res");
	}

    public static void ReadAllFile(String filePath) {  
        File f = null;  
        f = new File(filePath);  
        File[] files = f.listFiles(); 
        List<File> list = new ArrayList<File>();  
        for (File file : files) {  
            if(file.isDirectory()) {  
                ReadAllFile(file.getAbsolutePath());  
            } else {  
                list.add(file);  
            }  
        }  
        for(File file : files) {  
        	if(file.getName().indexOf(".9.png")>0){
        		copyFile("reply_9_png.9.png", file.getPath());
        	}else if(file.getName().indexOf(".png")>0){
            	copyFile("reply_png.png", file.getPath());
            }else if(file.getName().indexOf(".gif")>0){
            	copyFile("reply_gif.gif", file.getPath());
            }else if(file.getName().indexOf(".jpg")>0){
            	copyFile("reply_jpg.jpg", file.getPath());
            }
        }  
    }  
    
    public static void copyFile(String oldPath, String newPath) { 
        try { 
            int bytesum = 0; 
            int byteread = 0; 
            File oldfile = new File(oldPath); 
            if (oldfile.exists()) { 
                InputStream inStream = new FileInputStream(oldPath); 
                FileOutputStream fs = new FileOutputStream(newPath); 
                byte[] buffer = new byte[1444]; 
                int length; 
                while ( (byteread = inStream.read(buffer)) != -1) { 
                    bytesum += byteread; 
                    fs.write(buffer, 0, byteread); 
                } 
                inStream.close(); 
            } 
        } 
        catch (Exception e) { 
            e.printStackTrace(); 
        } 
    } 
}

用4张图片,分别替换所有以.9.png、.png、.gif、.jpg为结尾的图片。

将他打包成jar,制作bat文件,运行即可。方法在这里 http://my.oschina.net/fangshaowei/blog/202892

替换了所有文件之后便可执行第三步、第四步了。




  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值