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

    '''
    Created on 2013-6-6

    @author: DengWei
    '''

    import zipfile
    import os
    import shutil
    import sys

    class Zip(object):
    @staticmethod
    def zip_dir(dirname, zipfilename):

    # def writeFile(pathname, basename=""):
    # for filepath in os.listdir(pathname):
    # if os.path.isfile(dirname):
    # if basename:
    # zf.write(dirname, basename)
    # else:
    # zf.write(dirname)
    # else:
    # dir, name = os.path.split(filepath)
    # if basename:
    # basename = "%s/%s" % (basename, name)
    # else:
    # basename = name
    # writeFile(dir, basename)
    #
    # zf = zipfile.ZipFile(zipfilename, 'w', zipfile.zlib.DEFLATED)
    #
    # writeFile(dirname)

    os.system("compress.bat %s %s;"%(dirname, zipfilename))

    @staticmethod
    def unzip_file(zipfilename, unziptodir):
    if os.path.exists(unziptodir):
    shutil.rmtree(unziptodir)
    os.mkdir(unziptodir)

    zipobj = zipfile.ZipFile(zipfilename)

    zipobj.extractall(apkNameWithoutExt)

    if __name__ == "__main__":


    # APK_FOLDER ="c:\sinaNews3.2.1_52_release_wm_5062_0001_0520.apk"

    APK_FOLDER = sys.argv[-1]

    apkName = os.path.basename(APK_FOLDER)
    apkNameWithoutExt = apkName[0:-4]

    Zip.unzip_file(APK_FOLDER, apkNameWithoutExt)
    shutil.rmtree(os.path.join(os.getcwd(), apkNameWithoutExt, "META-INF"))
    Zip.zip_dir(apkNameWithoutExt, os.path.join(os.getcwd(), apkNameWithoutExt+"_sign.zip"))
    shutil.move(apkNameWithoutExt+"_sign.zip", apkNameWithoutExt+"_sign.apk")
    shutil.rmtree(os.path.join(os.getcwd(), apkNameWithoutExt))

    @echo off
    title 批量压缩rar文件

    if EXIST tmp_t del tmp_t
    reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe" /v path>>tmp_t
    for /f "tokens=1,2,* skip=4 delims= " %%j in ('more tmp_t') do set WinRAR=%%l
    if EXIST tmp_t del tmp_t

    set dst = %1
    cd %1

    "%WinRAR%\rar" a -r %2

    EndLocal

  • 相关阅读:
    prototype常用函数
    SQL Left Join,用于在网站中显示相关联的内容
    .net中ajax实现检测用户名的完整测子
    绑定数据源后,Repeater在创建时触发的事件,以及如果在cs文件中调用某个字段的值
    sql2005 转换到 sql2000
    FCKeditor 2.6.3在ASP.NET中的配置方法
    怎样和老板谈绩效考核(3)
    If Tomorrow Never Comes
    为何会被拒(1)
    为何会被拒(2)
  • 原文地址:https://www.cnblogs.com/dw729/p/3123322.html
Copyright © 2011-2022 走看看