• 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

  • 相关阅读:
    体检前注意事项
    SSO之CAS单点登录详细搭建教程
    如何通过session控制单点登录
    谈谈防止Ajax重复点击提交
    js判断是移动端还是pc端
    HttpClient通过GET和POST获取网页内容
    HttpClient 4.x 执行网站登录并抓取网页的代码
    360每日自动签到,领取积分 (java httpclient4.x)
    Java @override报错的解决方法
    无开发经验,初学python
  • 原文地址:https://www.cnblogs.com/dw729/p/3123322.html
Copyright © 2020-2023  润新知