美文网首页
批量对apk签名

批量对apk签名

作者: 738bc070cd74 | 来源:发表于2016-04-25 15:14 被阅读79次

    win 下对 apk 批量签名

    Paste_Image.png

    target 要签名路径
    out 产出
    build 临时
    make.py 执行签名

    # -*- coding: utf-8 -*-
    import os
    import shutil
    import os.path
    import re
    
    
    print(' 重签 start')
    BASE_DIR = os.path.dirname(__file__)
    
    out = os.path.exists('out')
    if(out):
    shutil.rmtree('out')
    os.mkdir('out')
    else:
    os.mkdir('out')
    
    _build = os.path.exists('build')
    if(_build):
    shutil.rmtree('build')
    os.mkdir('build')
    else:
    os.mkdir('build')
    
    keystore = 'game_2015_12_22_13_26_29_7M.keystore'
    keypass = '******'
    keyalias = '******'
    
    BASE_DIR = os.path.dirname(__file__)
    
    outDir = os.path.join(BASE_DIR, "out")
    buildDir = os.path.join(BASE_DIR, "build")
    targetDir = os.path.join(BASE_DIR, "target")
    list = os.listdir(os.path.join(BASE_DIR, "target"))
    for file in list:
    print(file)
    signedFile = os.path.join(buildDir, file + "signed.apk")
    outFile = os.path.join(outDir, file)
    
    f = os.path.join(targetDir, file)
    
    signcmd = 'jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore "%s" -storepass "%s" -signedjar "%s" "%s" "%s"' % (keystore, keypass, signedFile, f, keyalias)
    
    'jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore keystore -storepass keypass -signedjar signedFile file keyalias'
    os.system(signcmd)
    
    aligncmd = 'zipalign -f 4 "%s" "%s"' % (signedFile, outFile)
    os.system(aligncmd)
    print(file + " 完成")

    相关文章

      网友评论

          本文标题:批量对apk签名

          本文链接:https://www.haomeiwen.com/subject/bzxqrttx.html