浏览代码

一波游戏脚本

DONGGUOLIANGNEW\edy 1 年之前
父节点
当前提交
1bf2617111

+ 58 - 23
奥奇传说酷派/script.py

@@ -1,34 +1,69 @@
-# -*- coding:utf-8 -*-
-__author__ = 'ALIXie'
+# coding:utf8
+
+__author__ = '极无双'
 
 import os
 import logging
-import distutils.dir_util
-import gw_apk_tool
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
 
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    modify_manifest(decompileDir,"com.excelliance.lbsdk.debug.LBSdkCrashReportService","foregroundServiceType")
+    modify_manifest(decompileDir,"com.excelliance.lbsdk.base.AssistService","foregroundServiceType")
+    modify_manifest(decompileDir,"com.excelliance.lbsdk.base.BaseService","foregroundServiceType")
+    modify_manifest(decompileDir,"com.excelliance.lbsdk.main.BGService","foregroundServiceType")
+    # modify_manifest_common(decompileDir, "dataExtractionRules")
 
-def script_init(workspace_sdk_dir, extract_dir, channelSdkInfo, new_game_channel_info, game_info):
-    return
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
 
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName== providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
 
-def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
-    logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
-    s1 = os.path.join(decompileDir, "smali_classes6", "com")
-    smali_classes2_dir = gw_apk_tool.create_mutil_smali(decompileDir)
 
-    s3 = smali_classes2_dir
-    list_package = ["btgame"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    gw_apk_tool.move_package(s1, s3, list_package)
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
 
-    s1 = os.path.join(decompileDir, "smali_classes11", "com")
-    smali_classes2_dir = gw_apk_tool.create_mutil_smali(decompileDir)
-    s3 = os.path.join(smali_classes2_dir,"com")
-    list_package = ["btgame"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    gw_apk_tool.move_package(s1, s3, list_package)
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     ""

+ 95 - 0
少年仙界传酷派/script.py

@@ -0,0 +1,95 @@
+# coding:utf8
+
+__author__ = '极无双'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.debug.LBSdkCrashReportService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.base.AssistService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.base.BaseService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.main.BGService", "foregroundServiceType")
+    modify_manifest_activity(decompileDir, "org.cocos2dx.lua.AppActivity", "requestLegacyExternalStorage")
+    # modify_manifest_common(decompileDir, "dataExtractionRules")
+
+
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName == providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_activity(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/activity')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName == providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""

二进制
放开那三国3酷派/39285EFA.dex


+ 22 - 29
放开那三国3酷派/script.py

@@ -1,37 +1,30 @@
-# -*- coding:utf-8 -*-
-__author__ = 'ALIXie'
-
+# coding:utf8
 import os
 import logging
-import gw_data_center
-import gw_file_system
-import distutils.dir_util
-
-
-def script_init(workspace_sdk_dir, extract_dir, channelSdkInfo, new_game_channel_info, game_info):
-    gw_data_center.pack_small = False
-    return
-
-
-def script_first(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
-    logging.info("-----debug exec first func-----")
-    game_apk = decompileDir + "/../game.apk"
-    if os.path.exists(game_apk):
-        gw_file_system.delete_apk_file_by_aapt(game_apk, "assets/39285EFA.dex")
-    logging.info("-----debug-----")
-
-
-def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
-    dex = decompileDir + "../39285EFA.dex"
-    asserts = os.path.join(decompileDir, "assets/39285EFA.dex")
-    if os.path.exists(asserts) and os.path.exists(os.path.join(dex)):
-        distutils.dir_util.copy_tree(dex, asserts)
-    logging.info("-----debug-----")
+ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
+logger = logging.getLogger('script.py')
 
 
 def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    public_xml = os.path.join(extract_dir, "res/values/public.xml")
+    handle_public_xml(public_xml, "app_icon_round")
+
+def handle_public_xml(public_xml_path, remove_node):
+    if not os.path.exists(public_xml_path):
+        logging.info('public_xml is null: ' + public_xml_path)
+        return
+    new_lines = []
+    with open(public_xml_path, 'r+') as f:
+        for line in f.readlines():
+            # l = line.strip()
+            if line.find(remove_node) > -1:
+                continue
+            new_lines.append(line)
+        f.seek(0)
+        f.truncate()
+        f.writelines(new_lines)
     return
 
 
-if __name__ == "__main__":
-    ""
+if __name__ == '__main__':
+    script_last('', 'E:/script_test', {}, {}, {})

二进制
放开那三国3酷派/script.pyc


二进制
放开那三国3酷派/放开那三国3酷派.zip


+ 67 - 0
斗破苍穹三年之约酷派/script.py

@@ -0,0 +1,67 @@
+# coding:utf8
+
+__author__ = '极无双'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    # modify_manifest(decompileDir,"com.dena.lcx.sdk.internal.core.extras.update.DownloadService","foregroundServiceType")
+    # modify_manifest(decompileDir,"com.screenrecord.ScreenRecordService","foregroundServiceType")
+    modify_manifest_common(decompileDir, "dataExtractionRules")
+
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName== providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""

+ 67 - 0
灌篮高手正版授权手游/script.py

@@ -0,0 +1,67 @@
+# coding:utf8
+
+__author__ = '极无双'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    modify_manifest(decompileDir,"com.dena.lcx.sdk.internal.core.extras.update.DownloadService","foregroundServiceType")
+    modify_manifest(decompileDir,"com.screenrecord.ScreenRecordService","foregroundServiceType")
+    # modify_manifest_common(decompileDir, "allowNativeHeapPointerTagging")
+
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName== providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""

+ 20 - 0
画狐酷派/script.py

@@ -18,6 +18,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))
+
+    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")
     # 逆向渠道id
     if channel_sdk_info['id'] == '597':
         public_xml = os.path.join(extract_dir, "res/values/public.xml")
@@ -59,6 +75,10 @@ def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
 def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
     return
 
+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)
 
 def handle_public_xml(public_xml_path, remove_node):
     if not os.path.exists(public_xml_path):

+ 109 - 0
荒野迷城/script.py

@@ -0,0 +1,109 @@
+# coding:utf8
+
+__author__ = '极无双'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.debug.LBSdkCrashReportService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.base.AssistService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.base.BaseService", "foregroundServiceType")
+    modify_manifest(decompileDir, "com.excelliance.lbsdk.main.BGService", "foregroundServiceType")
+    # modify_manifest_common(decompileDir, "dataExtractionRules")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    # decompile_dir_path = os.path.join(decompileDir )
+    fix_coolyun_application_getinstance_null_bug(decompileDir)
+
+
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName == providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def fix_coolyun_application_getinstance_null_bug(decompile_dir):
+    insert_str_list = [
+        '\n\t.locals 1\n\n',
+        '\tsget-object v0, Lcom/coolyun/framework/CoolYunApplication;->application:Landroid/content/Context;\n\n',
+        '\tcheck-cast v0, Lcom/coolyun/framework/CoolYunApplication;\n\n',
+        '\treturn-object v0\n\n']
+    for dirpath, dirnames, filenames in os.walk(decompile_dir):
+        if r'com\coolyun\framework' in dirpath and 'CoolYunApplication.smali' in filenames:
+            smali_path = os.path.join(dirpath, 'CoolYunApplication.smali')
+            with open(smali_path, 'r') as f:
+                smali_str_arr = f.readlines()
+                index_str = '.method public static getInstance()Lcom/coolyun/framework/CoolYunApplication;'
+                end_method_str = '.end method'
+                insert_str = ''.join(insert_str_list)
+                on_create_index = 0
+                insert_index = 0
+                for line in smali_str_arr:
+                    if index_str in line:
+                        on_create_index = smali_str_arr.index(line)
+                        print('on_create_index', on_create_index, line)
+                        break
+                for index, value in enumerate(smali_str_arr):
+                    if index > on_create_index and end_method_str in value:
+                        insert_index = index
+                        print('insert_index', index)
+                        break
+                print(on_create_index, insert_index)
+                del smali_str_arr[on_create_index + 1:insert_index]
+                smali_str_arr.insert(on_create_index + 1, insert_str)
+            with open(smali_path, 'w') as f:
+                f.write(''.join(smali_str_arr))
+                break
+
+
+if __name__ == '__main__':
+    ""

+ 100 - 0
逍遥九重天酷派/script.py

@@ -0,0 +1,100 @@
+# coding:utf8
+
+__author__ = '极无双'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+from xml.etree import ElementTree as ET
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    # decompile_dir_path = os.path.join(decompileDir )
+    fix_coolyun_application_getinstance_null_bug(decompileDir)
+
+def modify_manifest(decompileDir, serviceName, key):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + key
+
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application/service')
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+            if serviceName == providerName:
+                try:
+                    del provider.attrib[authorities]
+                    # del provider.attrib[authoritiesTwo]
+                except:
+                    ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+    root_node.write(xmlparse, 'utf-8')
+
+
+def fix_coolyun_application_getinstance_null_bug(decompile_dir):
+    insert_str_list = [
+        '\n\t.locals 1\n\n',
+        '\tsget-object v0, Lcom/coolyun/framework/CoolYunApplication;->application:Landroid/content/Context;\n\n',
+        '\tcheck-cast v0, Lcom/coolyun/framework/CoolYunApplication;\n\n',
+        '\treturn-object v0\n\n']
+    for dirpath, dirnames, filenames in os.walk(decompile_dir):
+        if r'com\coolyun\framework' in dirpath and 'CoolYunApplication.smali' in filenames:
+            smali_path = os.path.join(dirpath, 'CoolYunApplication.smali')
+            with open(smali_path, 'r') as f:
+                smali_str_arr = f.readlines()
+                index_str = '.method public static getInstance()Lcom/coolyun/framework/CoolYunApplication;'
+                end_method_str = '.end method'
+                insert_str = ''.join(insert_str_list)
+                on_create_index = 0
+                insert_index = 0
+                for line in smali_str_arr:
+                    if index_str in line:
+                        on_create_index = smali_str_arr.index(line)
+                        print('on_create_index', on_create_index, line)
+                        break
+                for index, value in enumerate(smali_str_arr):
+                    if index > on_create_index and end_method_str in value:
+                        insert_index = index
+                        print('insert_index', index)
+                        break
+                print(on_create_index, insert_index)
+                del smali_str_arr[on_create_index + 1:insert_index]
+                smali_str_arr.insert(on_create_index + 1, insert_str)
+            with open(smali_path, 'w') as f:
+                f.write(''.join(smali_str_arr))
+                break
+
+
+if __name__ == '__main__':
+    ""

+ 31 - 0
锚点降临酷派/script.py

@@ -0,0 +1,31 @@
+# coding:utf8
+import os
+import logging
+ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
+logger = logging.getLogger('script.py')
+
+
+def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    public_xml = os.path.join(extract_dir, "res/values/public.xml")
+    handle_public_xml(public_xml, "app_icon_round")
+
+def handle_public_xml(public_xml_path, remove_node):
+    if not os.path.exists(public_xml_path):
+        logging.info('public_xml is null: ' + public_xml_path)
+        return
+    new_lines = []
+    with open(public_xml_path, 'r+') as f:
+        for line in f.readlines():
+            # l = line.strip()
+            if line.find(remove_node) > -1:
+                continue
+            new_lines.append(line)
+        f.seek(0)
+        f.truncate()
+        f.writelines(new_lines)
+    return
+
+
+
+if __name__ == '__main__':
+    script_last('', 'E:/script_test', {}, {}, {})

+ 1 - 160
风暴魔域2酷派/script.py

@@ -2,173 +2,14 @@
 
 __author__ = 'dong'
 
-import os
 import logging
-import xml.dom.minidom
-import re
-import shutil
-import glob
 import distutils.dir_util
 import os
-import gw_apk_tool
-import gw_file_system
-
-
-def script_second(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
-    return
 
 
 def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
     logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
-    if channelSdkInfo['id'] == '597':
-        logging.info("remove_navigate")
-        remove_navigate(decompileDir)
-
-
-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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["activity","annotation","appcompat","arch","asynclayoutinflater","browser"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["tracing","transition","vectordrawable","versionedparcelable","viewpager","viewpager2","webkit","work"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["cardview","collection","concurrent","constraintlayout","coordinatorlayout","core","cursoradapter","customview","documentfile","drawerlayout","dynamicanimation"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["emoji2","fragment","inspection","interpolator"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["print","recyclerview","resourceinspection","room","savedstate","security","slidingpanelayout","sqlite","startup","swiperefreshlayout"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["media","multidex","navigation"])
-
-        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")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["legacy","lifecycle","loader","localbroadcastmanager"])
-        # androidx 移动完毕
-
-        s1 = os.path.join(decompileDir, "smali_classes2", "com/kingsoft/shiyou/omnisdk")
-        if os.path.exists(s1):
-            smali_classes2_dir = create_mutil_smali(decompileDir)
-            s3 = os.path.join(smali_classes2_dir, "com/kingsoft/shiyou/omnisdk")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["plugin","project"])
-
-        s1 = os.path.join(decompileDir, "smali_classes2", "com/kingsoft/shiyou/omnisdk")
-        if os.path.exists(s1):
-            smali_classes2_dir = create_mutil_smali(decompileDir)
-            s3 = os.path.join(smali_classes2_dir, "com/kingsoft/shiyou/omnisdk")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["api","basic","channel","core"])
-        # smali_classes2结束
-
-        s1 = os.path.join(decompileDir, "smali_classes3", "com")
-        if os.path.exists(s1):
-            smali_classes2_dir = create_mutil_smali(decompileDir)
-            s3 = os.path.join(smali_classes2_dir, "com")
-            if not os.path.exists(s3):
-                distutils.dir_util.mkpath(s3)
-            move_package(s1, s3,["snyu","tencent","unionpay","unity3d","vmadalin","yulong"])
-    return
-
-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_11_bytedance(decompileDir):
-    s1 = os.path.join(decompileDir, "smali_classes11/com/bytedance")
-    smali_classes_new = create_mutil_smali(decompileDir)
-    s3 = os.path.join(decompileDir, smali_classes_new)
-    list_package = ["rocketapi", "wrapper_account", "wrapper_alog", "wrapper_appcloud", "wrapper_applog"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    move_package(s1, s3, list_package)
-
-    s1 = os.path.join(decompileDir, "smali_classes11/com/bytedance")
-    smali_classes_new = create_mutil_smali(decompileDir)
-    s3 = os.path.join(decompileDir, smali_classes_new)
-    list_package = ["wrapper_download", "wrapper_encrypt", "wrapper_jsbridge", "wrapper_librarian", "wrapper_net"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    move_package(s1, s3, list_package)
-
-    s1 = os.path.join(decompileDir, "smali_classes11/com/bytedance")
-    smali_classes_new = create_mutil_smali(decompileDir)
-    s3 = os.path.join(decompileDir, smali_classes_new)
-    list_package = ["wrapper_pangolinsdk", "wrapper_push", "wrapper_sdk_monitor", "wrapper_service_manager",
-                    "wrapper_setting_manager"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    move_package(s1, s3, list_package)
-
-    s1 = os.path.join(decompileDir, "smali_classes11/com/bytedance")
-    smali_classes_new = create_mutil_smali(decompileDir)
-    s3 = os.path.join(decompileDir, smali_classes_new)
-    list_package = ["wrapper_share", "wrapper_smartrouter", "wrapper_utility"]
-    if not os.path.exists(s3):
-        distutils.dir_util.mkpath(s3)
-    move_package(s1, s3, list_package)
-
-
-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
+    remove_navigate(decompileDir)
 
 
 def remove_navigate(decompileDir):