zoukankan      html  css  js  c++  java
  • android重签名

    #coding=utf-8
    '''
    Created on 2014-3-10
    
    @author: Administrator
    '''
    
    import zipfile
    import shutil 
    import os
    
    def resign(apk_path, resign_apk_path):
        if not os.path.exists(apk_path):
            raise 0, "apk is not exist"
        
        #
        zf = zipfile.ZipFile(apk_path)
        zf.extractall("test")
        zf.close()
        
        #
        shutil.rmtree(os.path.join("test", "META-INF"))
        
        #
        fileList = []
        for root, dirs, files in os.walk("test"):
            for name in files:
                fileList.append(os.path.join(root, name))
        
        zf = zipfile.ZipFile("test.apk", "w", zipfile.zlib.DEFLATED)
        for tar in fileList:
            print tar
            arcname = tar[len("test"):]
            zf.write(tar, arcname)
        zf.close()
        
        os.system("jarsigner -keystore debug.keystore -storepass android -signedjar %s test.apk androiddebugkey"%resign_apk_path)
        
    if __name__ == "__main__":
        resign("E:/my_work/android/baiduxinwen_3309.apk", "test1.apk")
  • 相关阅读:
    [HAOI2008]糖果传递
    [HAOI2008]木棍分割
    [HAOI2008]硬币购物
    [ZJOI2008]泡泡堂
    [JSOI2007]建筑抢修
    [JSOI2007]麻将
    [Note]prufer
    [BZOJ3275]Number
    [POI2014]RAJ-Rally
    [JSOI2010]快递服务
  • 原文地址:https://www.cnblogs.com/dw729/p/3592257.html
Copyright © 2011-2022 走看看