init
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Change package name of apk
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def rename_dir(src, dst):
|
||||
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
||||
os.rename(src, dst)
|
||||
|
||||
|
||||
def apply(config: dict) -> bool:
|
||||
assert config["new_package_name"] is not None, "new_package_name is not configured"
|
||||
|
||||
for root, dirs, files in os.walk("./decompiled"):
|
||||
for filename in files:
|
||||
file_path = os.path.join(root, filename)
|
||||
|
||||
if os.path.isfile(file_path):
|
||||
try:
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
file_contents = file.read()
|
||||
|
||||
new_contents = file_contents.replace(
|
||||
"com.swiftsoft.anixartd", config["new_package_name"]
|
||||
)
|
||||
new_contents = new_contents.replace(
|
||||
"com/swiftsoft/anixartd",
|
||||
config["new_package_name"].replace(".", "/"),
|
||||
)
|
||||
|
||||
with open(file_path, "w", encoding="utf-8") as file:
|
||||
file.write(new_contents)
|
||||
except:
|
||||
pass
|
||||
|
||||
rename_dir(
|
||||
"./decompiled/smali/com/swiftsoft/anixartd",
|
||||
os.path.join(
|
||||
"./decompiled", "smali", config["new_package_name"].replace(".", "/")
|
||||
),
|
||||
)
|
||||
rename_dir(
|
||||
"./decompiled/smali_classes2/com/swiftsoft/anixartd",
|
||||
os.path.join(
|
||||
"./decompiled",
|
||||
"smali_classes2",
|
||||
config["new_package_name"].replace(".", "/"),
|
||||
),
|
||||
)
|
||||
|
||||
os.rmdir("./decompiled/smali_classes2/com/swiftsoft")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
# smali_classes2/com/wowlikon/anixart/utils/DeviceInfoUtil.smali: const-string v3, "\u0411\u0430\u0433-\u0440\u0435\u043f\u043e\u0440\u0442 9.0 BETA 5 (25062213)"
|
||||
Reference in New Issue
Block a user