首页 技术 正文
技术 2022年11月8日
0 收藏 437 点赞 1,784 浏览 1330 个字

1.准备工作

1.1 反编译工具apktool下载

1.2 java, android SDK安装

1.2 python安装

2.反编译现有包

apktool.bat d test.apk

3. 直接上代码

import re
import os
import shutilfile_path = 'F:\\apk\\test\\AndroidManifest.xml'root_path = "F:\\apk\\test\\smali\\com\\test\\package" #smali文件夹下包名目录
def modify_package(package_org, package_name):
with open(file_path, 'r') as f:
file_content = f.read()
new_file = file_content.replace(package_org, package_name) with open(file_path, 'w') as f:
f.write(new_file) list_dirs = os.walk(root_path)
other_package = package_name.replace('.', '/')
other_package_org = package_org.replace('.', '/')
for root, dirs, files in list_dirs:
for file_name in files:
path = root_path + '/' + file_name
modify_file = ''
with open(path, 'rb') as f:
file_s = f.read()
modify_file = file_s.replace(other_package_org, other_package) with open(path, 'wb') as f:
f.write(modify_file) copy_name = "F:\\apk\\" + package_name + "org.apk"
dist_name = "F:\\apk\\" + package_name + ".apk"
os.system('apktool b F:\\apk\\test') #重新打包
shutil.copy('F:\\apk\\test\\dist\\test.apk', copy_name)
shell_cmd = 'jarsigner -verbose -keystore key.key -storepass password -keypass password -signedjar ' + dist_name + ' ' + copy_name + ' alianame' os.system(shell_cmd) # 添加签名if __name__ == '__main__' :
filelines = ''
with open('channel.txt', 'rb') as f_c: #channel.txt是需要切的包的包名,一行一个包名
filelines = f_c.readlines() package_org = 'com.test.pacakge'
for line in filelines :
modify_package(package_org, line.strip())
package_org = line.strip()
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,107
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,583
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,430
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,201
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919