|
|
@@ -19,6 +19,22 @@ ANDROID_NS = 'http://schemas.android.com/apk/res/android'
|
|
|
def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
|
|
|
logging.info('script_second: ' + str(channel_sdk_info))
|
|
|
# 逆向渠道id
|
|
|
+ modify_manifest(extract_dir, "hasFragileUserData")
|
|
|
+ remove_value(extract_dir, "values-v31")
|
|
|
+ remove_value(extract_dir, "color-v31")
|
|
|
+
|
|
|
+ public_xml = os.path.join(extract_dir, "res/values/public.xml")
|
|
|
+ handle_public_xml(public_xml ,"m3_ref_palette_dynamic_neutral")
|
|
|
+ handle_public_xml(public_xml ,"m3_ref_palette_dynamic_primary")
|
|
|
+ handle_public_xml(public_xml ,"m3_ref_palette_dynamic_secondary")
|
|
|
+ handle_public_xml(public_xml ,"m3_ref_palette_dynamic_tertiary")
|
|
|
+ handle_public_xml(public_xml ,"m3_sys_color_dynamic_dark")
|
|
|
+ handle_public_xml(public_xml ,"m3_sys_color_dynamic_light")
|
|
|
+ handle_public_xml(public_xml ,"material_dynamic_neutral")
|
|
|
+ handle_public_xml(public_xml ,"material_dynamic_primary")
|
|
|
+ handle_public_xml(public_xml ,"material_dynamic_secondary")
|
|
|
+ handle_public_xml(public_xml ,"material_dynamic_tertiary")
|
|
|
+ handle_public_xml(public_xml ,"m3_dynamic")
|
|
|
sdk_id = channel_sdk_info['id']
|
|
|
if sdk_id == "597" :#深圳 成都都是用这个id
|
|
|
public_xml = os.path.join(extract_dir, "res/values/public.xml")
|
|
|
@@ -70,78 +86,6 @@ def handle_public_xml(public_xml_path, remove_node):
|
|
|
return
|
|
|
|
|
|
|
|
|
-def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
|
|
|
- logging.info("-----debug-----")
|
|
|
-
|
|
|
-
|
|
|
-def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
|
|
|
- sdk_id = channelSdkInfo['id']
|
|
|
- if sdk_id == "597":
|
|
|
- s1 = os.path.join(decompileDir, "smali","androidx")
|
|
|
- if os.path.exists(s1):
|
|
|
- smali_classes2_dir = create_mutil_smali(decompileDir)
|
|
|
- s3 = os.path.join(smali_classes2_dir, "androidx")
|
|
|
- list_package = ["fragment", "interpolator", "legacy", "lifecycle", "loader", "localbroadcastmanager"]
|
|
|
- list_package.extend(
|
|
|
- ["multidex", "print", "recyclerview", "slidingpanelayout", "swiperefreshlayout", "vectordrawable",
|
|
|
- "versionedparcelable", "viewpager"])
|
|
|
- if not os.path.exists(s3):
|
|
|
- distutils.dir_util.mkpath(s3)
|
|
|
- move_package(s1, s3, list_package)
|
|
|
-
|
|
|
- return
|
|
|
-
|
|
|
-def create_mutil_smali(decompileDir):
|
|
|
- f_idx = 2
|
|
|
- while True:
|
|
|
- tmp = gw_file_system.get_full_path(os.path.join(decompileDir, 'smali_classes%d' % f_idx))
|
|
|
- tmp = tmp.replace('\\', '/')
|
|
|
- tmp = re.sub('/+', '/', tmp)
|
|
|
- if os.path.exists(tmp):
|
|
|
- f_idx += 1
|
|
|
- else:
|
|
|
- smali_classes2_dir = tmp
|
|
|
- break
|
|
|
- # endwhile
|
|
|
- os.mkdir(smali_classes2_dir)
|
|
|
- return smali_classes2_dir
|
|
|
-
|
|
|
-
|
|
|
-def move_package(s1, s3, list_package):
|
|
|
- for d in list_package:
|
|
|
- src = os.path.join(s1, d)
|
|
|
- if os.path.exists(src):
|
|
|
- dst = os.path.join(s3, d)
|
|
|
- distutils.dir_util.copy_tree(src, dst)
|
|
|
- distutils.dir_util.remove_tree(src)
|
|
|
-
|
|
|
-
|
|
|
-def move_package_one(src, dst):
|
|
|
- if os.path.exists(src):
|
|
|
- distutils.dir_util.copy_tree(src, dst)
|
|
|
- distutils.dir_util.remove_tree(src)
|
|
|
-
|
|
|
-
|
|
|
-change_map = {".super Landroid/app/Application;": ".super Lcom/kf/framework/KFApplication;",
|
|
|
- "invoke-direct {p0}, Landroid/app/Application;-><init>()V": "invoke-direct {p0}, Lcom/kf/framework/KFApplication;-><init>()V",
|
|
|
- "invoke-super {p0, p1}, Landroid/app/Application;->attachBaseContext(Landroid/content/Context;)V": "invoke-super {p0, p1}, Lcom/kf/framework/KFApplication;->attachBaseContext(Landroid/content/Context;)V",
|
|
|
- "invoke-super {p0}, Landroid/app/Application;->onCreate()V": "invoke-super {p0}, Lcom/kf/framework/KFApplication;->onCreate()V", }
|
|
|
-
|
|
|
-
|
|
|
-def replace_super_application(decompileDir):
|
|
|
- smali_files = glob.glob(
|
|
|
- os.path.join(decompileDir, 'smali*/com/radical/huangshangjixiang/qh360/CoronaApplication.smali'))
|
|
|
- if len(smali_files) == 1:
|
|
|
- game_application_file = smali_files[0];
|
|
|
- print game_application_file
|
|
|
- if os.path.isfile(game_application_file):
|
|
|
- with open(game_application_file, "r+") as f:
|
|
|
- file_str = f.read()
|
|
|
- for k, v in change_map.items():
|
|
|
- file_str = file_str.replace(k, v)
|
|
|
- with open(game_application_file, "w+") as f:
|
|
|
- f.write(file_str)
|
|
|
-
|
|
|
|
|
|
def modify_manifest(decompileDir, removeKey):
|
|
|
ET.register_namespace('android', ANDROID_NS)
|
|
|
@@ -167,6 +111,10 @@ def modify_manifest(decompileDir, removeKey):
|
|
|
root_node.write(xmlparse, 'utf-8')
|
|
|
|
|
|
|
|
|
+def remove_value(decompileDir, remove_dir):
|
|
|
+ tmp_res = os.path.join(decompileDir, "res", remove_dir)
|
|
|
+ if os.path.exists(tmp_res):
|
|
|
+ distutils.dir_util.remove_tree(tmp_res)
|
|
|
if __name__ == '__main__':
|
|
|
# replace_super_application("D:\work\wzdq")
|
|
|
modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")
|