Jenkins奇技淫巧 — Python乐固,多渠道打包篇(Android自动化构建)


Jenkins奇技淫巧 — 安装篇(mac)
Jenkins奇技淫巧 — 配置篇
Jenkins奇技淫巧 — 安全篇
Jenkins奇技淫巧 — 发送邮件篇
Jenkins奇技淫巧 — 全局变量篇
Jenkins奇技淫巧 — 新建任务篇
Jenkins奇技淫巧 — 插件篇
Jenkins奇技淫巧 — 问题篇
Jenkins奇技淫巧 — 命令篇
Jenkins奇技淫巧 — 环境配置篇(Android自动化构建)
Jenkins奇技淫巧 — 参数化构建篇(Android自动化构建)
Jenkins奇技淫巧 — 第一次实战篇(Android自动化构建)
Jenkins奇技淫巧 — Python打包篇(Android自动化构建)

Jenkins奇技淫巧 — Python发送邮件和上传蒲公英(Android自动化构建)

Jenkins奇技淫巧 — 乐固,多渠道打包篇(Android自动化构建)
Jenkins奇技淫巧 — 节点管理篇
Jenkins奇技淫巧 — 优秀文章篇


简介

基于应用安全考虑,很多厂商都会给自家应用加固,加固的方式很多,各有各的特点,为了减少加固过程带来的工作量,接下来将使用Python脚本实现应用的加固,下载和发送邮件。

乐固加固

  • 乐固(腾讯产品,有免费套餐)
  • [官网 ](http://legu.qcloud.co
  • 参考网站
    https://cloud.tencent.com/document/api/283/17750
    def __init__(self):
        self.secret_id = '乐固id'
        self.secret_key = '乐固key'
        self.steady_file_directory = 'android/app/build/Steady/'


    def Steady(self):
        steady_file_path = ''
        for fpath, dirname, fnames in os.walk(self.steady_file_directory):
            print(dirname)
            break
        steady_file_path = dirname[0]


        apkResignerForWallePath = 'android/ProtectedApkResignerForWalle'
        apk_path = self.steady_file_directory + steady_file_path + '/online/app-online-release.apk'
        download_path = self.steady_file_directory + '/download'

        cmdLeguStr = (
                ' rm -rf ' + download_path + '/*.apk'
                + '\n rm -rf ' + download_path
                + '\n mkdir ' + download_path
                + '\n java -Dfile.encoding=utf-8 -jar auto_build/lib/ms-shield.jar '
                + '-sid %s -skey %s -uploadPath %s -downloadPath %s' %(self.secret_id, self.secret_key, apk_path, download_path)
        )

        print('===========开始上传,并加固,请耐心等待~================')

        self.exeShellCmd(cmdLeguStr)

        legu_app_path = ''
        app_version_name = ''
        current_time = time.strftime("%Y-%m-%d_%H%M%S", time.localtime())

        for fpath, dirname, fnames in os.walk(download_path):
            print(fnames)
            print(fpath)
            fname = fnames[0]
            legu_app_path = fpath
            legu_app_path = legu_app_path + '/' + fname
            app_version_name = self.getApkVersionName(legu_app_path)

            new_name = 'app-release-v%s-%s-legu.apk' %(app_version_name, current_time)
            old_path = os.path.join(fpath, fname)
            new_path = os.path.join(fpath, new_name)
            os.rename(old_path, new_path)
            legu_app_path = new_path

            print('leguAppPath = ' + legu_app_path)
            break

        self.buildChannels(apk_path,app_version_name,current_time,'_360appmarket')

多渠道打包

请自行参考美团多渠道打包工具
https://github.com/mcxiaoke/packer-ng-plugin

你可能感兴趣的:(Jenkins奇技淫巧 — Python乐固,多渠道打包篇(Android自动化构建))