浏览代码

新增加脚本

dongguoliang@kuaifazs.com 3 年之前
父节点
当前提交
d991dcaa4c

+ 191 - 0
66小鸭鸭酷派/script.py

@@ -0,0 +1,191 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    gw_data_center.pack_small=True
+    return
+
+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
+    if channel_sdk_info['id'] == '597':
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/layout-sw600dp/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "mtrl_layout_snackbar")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar_include.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/drawable-v21/abc_dialog_material_background.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values-v21/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+    return
+
+
+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
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+
+    # if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+   if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,)
+            list_package = ["androidx"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["alipay","android","asus","bumptech","bun","bytedance","cmic","coolpad","flamingo_inc","google","hg6wan","huawei","ipaynow","llxyy"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+   if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+        s1 = os.path.join(decompileDir, "smali_classes5","androidx")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["activity","appcompat","collection","core","customview","exifinterface","interpolator","lifecycle","annotation","arch","constraintlayout","cursoradapter","drawerlayout","fragment","legacy","loader"]
+            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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 177 - 0
rose/script.py

@@ -0,0 +1,177 @@
+# encoding: utf-8
+import re
+
+__author__ = 'pengtao'
+
+import logging
+import os
+import yaml
+import xml.etree.ElementTree as ET
+import re
+
+logger = logging.getLogger('script.py')
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    print("")
+    xmlparse(decompileDir)
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    print("")
+    replace_rose_resource(decompileDir)
+    fix_install_fail_bug(decompileDir)
+    fix_android8_bug_rose(decompileDir)
+    fix_rose_recharge_screen_orientation(decompileDir)
+
+
+def fix_rose_recharge_screen_orientation(decompile_dir_path):
+    developer_path = os.path.join(decompile_dir_path, 'assets', 'developer.properties')
+    print(developer_path)
+    is_landscape = True
+    with open(developer_path, 'r') as f:
+        smali_str_arr = f.readlines()
+        for line in smali_str_arr:
+            if 'screen_oriention' in line:
+                results = re.findall(re.compile(r'\d'), line)
+                if len(results) != 0:
+                    orientation_value = results[0]
+                    print('orientation_value', orientation_value)
+                    is_landscape = int(orientation_value) == 0
+                    break
+    print('is_landscape', is_landscape)
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir_path, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    activity_nodes = xml_root.findall('.//activity')
+    print(activity_nodes)
+    for activity_node in activity_nodes:
+        print(activity_node.attrib)
+        activity_name = activity_node.get('%sname' % namespace)
+        print(activity_name)
+        if 'com.wanwu.sdkkit.gameplatform.activity.RechargeActivity' == activity_name:
+            if is_landscape:
+                activity_node.set('%sscreenOrientation' % namespace, 'landscape')
+            else:
+                activity_node.set('%sscreenOrientation' % namespace, 'portrait')
+            xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+            break
+
+
+def fix_android8_bug_rose(decompile_dir):
+    style_xml_path = os.path.join(decompile_dir, 'res', 'values', 'styles.xml')
+    xml_tree = ET.parse(style_xml_path)
+    xml_root = xml_tree.getroot()
+    style_roots = xml_root.findall('./style')
+    for style_root in style_roots:
+        if style_root.get('name') == 'ydzs_splash_translucent':
+            items = style_root.findall('./item')
+            for item in items:
+                print('item name', item.get('name'))
+                print(item.findtext('.'))
+                if item.get('name') == 'android:windowIsTranslucent':
+                    item.text = 'false'
+            xml_tree.write(style_xml_path, encoding='utf-8', xml_declaration=True)
+            break
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    act_list = xml_root.findall('.//activity')
+    for act in act_list:
+        act_name = act.get('%sname' % namespace)
+        print(act_name)
+        if 'com.wanwu.sdkkit.gameplatform.activity.RechargeActivity' == act_name:
+            act_theme = act.get('%stheme' % namespace)
+            print('act_theme', act_theme)
+            act.set('%stheme' % namespace, '@style/ydzs_splash_translucent')
+            xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+            break
+
+
+def xmlparse(decompileDir):
+    ET.register_namespace("android",ANDROID_NS)
+    xmlpath = os.path.join(decompileDir, 'AndroidManifest.xml')
+    root_node = ET.parse(xmlpath)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}authorities'
+    package_name = root.attrib.get('package')
+
+    if package_name is None:
+        return
+    providers = root.findall("./application/provider")
+    if providers != None:
+        for provider in providers:
+            providerName = provider.attrib.get(name)
+
+            if 'android.support.haojieru.v4.content.FileProvider' == providerName:
+                provider.set(authorities, package_name + '.rose2.fileProvider')
+    root_node.write(xmlpath, 'utf-8')
+
+def fix_install_fail_bug(decompile_dir_path):
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir_path, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    application_node = xml_root.find('./application')
+    etract_value = application_node.get('%sextractNativeLibs' % namespace)
+    if etract_value is not None and etract_value == 'false':
+        # 修改extractNativeLib
+        application_node.set('%sextractNativeLibs' % namespace, 'true')
+        xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+
+    yaml_path = os.path.join(decompile_dir_path, 'apktool.yml')
+    file = open(yaml_path, 'r')
+    yaml_result = yaml.load(file, Loader=yaml.BaseLoader)
+    sdk_info = yaml_result['sdkInfo']
+    yaml_result['packageInfo']['renameManifestPackage'] = None
+    print(sdk_info)
+    if sdk_info.has_key('targetSdkVersion') and int(sdk_info['targetSdkVersion']) > 29:
+        sdk_info['targetSdkVersion'] = '29'
+        print(sdk_info)
+        file.close()
+        with open(yaml_path, 'w') as f:
+            # yaml.dump(yaml_result, f)
+            yaml.safe_dump(yaml_result, f,allow_unicode=True, default_flow_style=False)
+
+def find_r_smali_and_replace(smali_file_path, regex_str):
+    with open(smali_file_path, 'r') as f:
+        smali_str = f.read()
+        pattern = re.compile(regex_str)
+        resource_arr = pattern.findall(smali_str)
+        if len(resource_arr) > 0:
+            print(smali_file_path)
+        for r_str in resource_arr:
+            virtual_name = r_str[r_str.index(' ') + 1:r_str.index(',')]
+            print(virtual_name)
+            resource_type = r_str[r_str.index('R$') + 2:r_str.index(';')].capitalize()
+            print(resource_type)
+            resource_name = r_str[r_str.index('->') + 2:r_str.index(':')]
+            print(resource_name)
+            new_r_str = "const-string %s, \"%s\"\n\n\tinvoke-static {%s}, Lcom/ydzs/framework/MommyUtils;->get%sId(Ljava/lang/String;)I\n\n\tmove-result %s" % (
+                virtual_name, resource_name, virtual_name, resource_type, virtual_name)
+            print(new_r_str)
+            smali_str = smali_str.replace(r_str, new_r_str)
+    with open(smali_file_path, 'w') as f:
+        f.write(smali_str)
+
+
+def replace_rose_resource(d_dir):
+    r_regex_str = r'sget[^\n]*R\$layout[^\n]*I|sget[^\n]*R\$id[^\n]*I|sget[^\n]*R\$drawable[^\n]*I|sget[^\n]*R\$string[^\n]*I|sget[^\n]*R\$array[^\n]*I|sget[^\n]*R\$bool[^\n]*I|sget[^\n]*R\$integer[^\n]*I'
+    for dirpath, dirnames, filenames in os.walk(d_dir):
+        if r'com\ydzs' in dirpath:
+            for smali_file in filenames:
+                smali_file_path = os.path.join(dirpath, smali_file)
+                # print(smali_file_path)
+                find_r_smali_and_replace(smali_file_path, r_regex_str)
+
+
+if __name__ == '__main__':
+    xmlparse("D:/x7debug")
+

+ 25 - 0
smallsheep/apktool.yml

@@ -0,0 +1,25 @@
+apkFileName: game.apk
+compressionType: false
+doNotCompress:
+- resources.arsc
+- png
+- assets/ABfile/Android/buildversion.txt
+isFrameworkApk: false
+packageInfo:
+  forcedPackageId: '127'
+  renameManifestPackage: null
+sdkInfo:
+  minSdkVersion: '19'
+  targetSdkVersion: '28'
+sharedLibrary: false
+sparseResources: false
+unknownFiles:
+  androidsupportmultidexversion.txt: '0'
+usesFramework:
+  ids:
+  - 1
+  tag: null
+version: 2.6.0
+versionInfo:
+  versionCode: '1'
+  versionName: 0.0.201.225

+ 130 - 0
smallsheep/script.py

@@ -0,0 +1,130 @@
+# encoding: utf-8
+import logging
+import os
+import yaml
+import xml.etree.ElementTree as ET
+import re
+__author__ = 'billyyoyo'
+
+ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android'
+
+def change_application_id(extra_dir, packageName):
+    fname = extra_dir + '/AndroidManifest.xml'
+    with open(fname, 'r+') as f:
+        cont = f.read()
+        findstr = '#applicationId#'
+        rStr = packageName+'.smallsheep'
+        cont = cont.replace(findstr, rStr)
+        f.seek(0)
+        f.truncate(len(cont))
+        f.write(cont)
+        f.close()
+
+def fix_xmy_recharge_screen_orientation(decompile_dir_path):
+    developer_path = os.path.join(decompile_dir_path, 'assets', 'developer.properties')
+    print(developer_path)
+    is_landscape = True
+    with open(developer_path, 'r') as f:
+        smali_str_arr = f.readlines()
+        for line in smali_str_arr:
+            if 'screen_oriention' in line:
+                results = re.findall(re.compile(r'\d'), line)
+                if len(results) != 0:
+                    orientation_value = results[0]
+                    print('orientation_value', orientation_value)
+                    is_landscape = int(orientation_value) == 0
+                    break
+    print('is_landscape', is_landscape)
+    if not is_landscape:
+        return
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir_path, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    activity_nodes = xml_root.findall('.//activity')
+    print(activity_nodes)
+    for activity_node in activity_nodes:
+        print(activity_node.attrib)
+        activity_name = activity_node.get('%sname' % namespace)
+        print(activity_name)
+        if 'com.yog.kothoth.view.activity.SSRechargeActivity' == activity_name:
+            activity_node.set('%sscreenOrientation' % namespace, 'landscape')
+            xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+            break
+
+def fix_install_fail_bug(decompile_dir_path):
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir_path, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    application_node = xml_root.find('./application')
+    etract_value = application_node.get('%sextractNativeLibs' % namespace)
+    if etract_value is not None and etract_value == 'false':
+        # 修改extractNativeLib
+        application_node.set('%sextractNativeLibs' % namespace, 'true')
+        xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+
+    yaml_path = os.path.join(decompile_dir_path, 'apktool.yml')
+    file = open(yaml_path, 'r')
+    yaml_result = yaml.load(file, Loader=yaml.BaseLoader)
+    sdk_info = yaml_result['sdkInfo']
+    yaml_result['packageInfo']['renameManifestPackage'] = None
+    print(sdk_info)
+    if sdk_info.has_key('targetSdkVersion') and int(sdk_info['targetSdkVersion']) > 29:
+        sdk_info['targetSdkVersion'] = '29'
+        print(sdk_info)
+        file.close()
+        with open(yaml_path, 'w') as f:
+            # yaml.dump(yaml_result, f)
+            yaml.safe_dump(yaml_result, f,allow_unicode=True, default_flow_style=False)
+
+
+def fix_android8_bug_xmy(decompile_dir):
+    style_xml_path = os.path.join(decompile_dir, 'res', 'values', 'styles.xml')
+    xml_tree = ET.parse(style_xml_path)
+    xml_root = xml_tree.getroot()
+    style_roots = xml_root.findall('./style')
+    for style_root in style_roots:
+        if style_root.get('name') == 'kf_splash_translucent':
+            items = style_root.findall('./item')
+            for item in items:
+                print('item name', item.get('name'))
+                print(item.findtext('.'))
+                if item.get('name') == 'android:windowIsTranslucent':
+                    item.text = 'false'
+            xml_tree.write(style_xml_path, encoding='utf-8', xml_declaration=True)
+            break
+    namespace = '{http://schemas.android.com/apk/res/android}'
+    ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
+    manifest_path = os.path.join(decompile_dir, 'AndroidManifest.xml')
+    xml_tree = ET.parse(manifest_path)
+    xml_root = xml_tree.getroot()
+    act_list = xml_root.findall('.//activity')
+    for act in act_list:
+        act_name = act.get('%sname' % namespace)
+        print(act_name)
+        if 'com.yog.kothoth.view.activity.SSShoppingMallActivity' == act_name or 'com.yog.kothoth.view.activity.SSRechargeActivity' == act_name:
+            act_theme = act.get('%stheme' % namespace)
+            print('act_theme', act_theme)
+            act.set('%stheme' % namespace, '@style/kf_splash_translucent')
+            xml_tree.write(manifest_path, encoding='utf-8', xml_declaration=True)
+            break
+
+
+def script(work_sdk_dir, extra_dir, channel_sdk_info, new_game_channel_info, game_info):
+    logging.info("---------------channel_sdk_info-------------")
+    logging.info(channel_sdk_info)
+    logging.info("---------------new_game_channel_info-------------")
+    logging.info(new_game_channel_info)
+    logging.info("---------------game_info-------------")
+    logging.info(game_info)
+    applicationId = channel_sdk_info["packNameSuffix"]
+    change_application_id(extra_dir, applicationId)
+    fix_install_fail_bug(extra_dir)
+    fix_xmy_recharge_screen_orientation(extra_dir)
+    fix_android8_bug_xmy(extra_dir)
+
+if __name__ == '__main__':
+    script("", ".", {'package_name':'com.netease.dwrg.yl.ludashi'}, {}, {})

+ 192 - 0
兽王降临酷派/script.py

@@ -0,0 +1,192 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    # gw_data_center.pack_small=True
+    return
+
+def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    return
+    logging.info('script_second: ' + str(channel_sdk_info))
+    # 逆向渠道id
+    if channel_sdk_info['id'] == '597':
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/layout-sw600dp/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "mtrl_layout_snackbar")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar_include.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/drawable-v21/abc_dialog_material_background.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values-v21/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+    return
+
+
+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
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+
+    # if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+   # if channelSdkInfo['id'] == '597':
+   #      s1 = os.path.join(decompileDir, "smali")
+   #      if os.path.exists(s1):
+   #          smali_classes_new = create_mutil_smali(decompileDir)
+   #          s3 = os.path.join(decompileDir, smali_classes_new,)
+   #          list_package = ["androidx"]
+   #          if not os.path.exists(s3):
+   #              distutils.dir_util.mkpath(s3)
+   #          move_package(s1, s3, list_package)
+   #
+   #      s1 = os.path.join(decompileDir, "smali_classes2","com")
+   #      if os.path.exists(s1):
+   #          smali_classes_new = create_mutil_smali(decompileDir)
+   #          s3 = os.path.join(decompileDir, smali_classes_new,"com")
+   #          list_package = ["alipay","android","asus","bumptech","bun","bytedance","cmic","coolpad","flamingo_inc","google","hg6wan","huawei","ipaynow","llxyy"]
+   #          if not os.path.exists(s3):
+   #              distutils.dir_util.mkpath(s3)
+   #          move_package(s1, s3, list_package)
+
+   if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali","androidx")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["activity","appcompat","collection","core","customview","exifinterface","interpolator","lifecycle","annotation","arch","constraintlayout","cursoradapter","drawerlayout","fragment","legacy","loader"]
+            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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 222 - 0
十万个冷笑话2022酷派/script.py

@@ -0,0 +1,222 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    # gw_data_center.pack_small=True
+    return
+
+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
+    if channel_sdk_info['id'] == '549':
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_background_transition_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_item_background_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
+        handle_public_xml(public_xml, "abc_list_selector_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
+        handle_public_xml(public_xml, "abc_item_background_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_item_background_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable/abc_list_selector_background_transition_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_list_selector_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_pressed_holo_dark.9.png")
+        logging.info("public_xml:" + public_xml)
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir,
+                                  "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+
+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
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+
+   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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+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__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 120 - 0
古魂之刃/script.py

@@ -0,0 +1,120 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+import gw_file_system
+from xml.etree import ElementTree as ET
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    return
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
+    if channelSdkInfo['id'] == "549":
+        s1 = os.path.join(decompileDir, "smali")
+        smali_classes_new = create_mutil_smali(decompileDir)
+        s3 = os.path.join(decompileDir, smali_classes_new)
+        list_package = ["androidx"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+        #
+        # s1 = os.path.join(decompileDir, "smali_classes5/com")
+        # smali_classes_new = create_mutil_smali(decompileDir)
+        # s3 = os.path.join(decompileDir, smali_classes_new)
+        # list_package = ["friendtime", "friendtimes", "ft", "GF"]
+        # if not os.path.exists(s3):
+        #     distutils.dir_util.mkpath(s3)
+        # move_package(s1, s3, list_package)
+
+    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 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 modify_manifest(decompileDir):
+    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 + '}foregroundServiceType'
+    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 'com.netease.cc.screen_record.codec.screencapture.ScreenCaptureService' == providerName:
+                # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+                try:
+                    del provider.attrib[authorities]
+                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')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""
+    # replace_super_application("D:\\work\\bh")

+ 120 - 0
天龙八部2飞龙战天酷派/script.py

@@ -0,0 +1,120 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+import gw_file_system
+from xml.etree import ElementTree as ET
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    return
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
+    if channelSdkInfo['id'] == "597":
+        s1 = os.path.join(decompileDir, "smali_classes3")
+        smali_classes_new = create_mutil_smali(decompileDir)
+        s3 = os.path.join(decompileDir, smali_classes_new)
+        list_package = ["androidx"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+        #
+        # s1 = os.path.join(decompileDir, "smali_classes5/com")
+        # smali_classes_new = create_mutil_smali(decompileDir)
+        # s3 = os.path.join(decompileDir, smali_classes_new)
+        # list_package = ["friendtime", "friendtimes", "ft", "GF"]
+        # if not os.path.exists(s3):
+        #     distutils.dir_util.mkpath(s3)
+        # move_package(s1, s3, list_package)
+
+    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 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 modify_manifest(decompileDir):
+    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 + '}foregroundServiceType'
+    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 'com.netease.cc.screen_record.codec.screencapture.ScreenCaptureService' == providerName:
+                # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+                try:
+                    del provider.attrib[authorities]
+                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')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    ""
+    # replace_super_application("D:\\work\\bh")

+ 19 - 0
奥奇传说/script.py

@@ -22,6 +22,25 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
         distutils.dir_util.mkpath(s3)
     gw_apk_tool.move_package(s1, s3, list_package)
 
+    if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali_classes9", "com","baitian")
+        if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new, "com","baitian")
+            list_package = ["alx","aqcs","aqcsgfsy","aqcssyb","bridge","getui","lebian","netkitWrap","notice","android","aqcsgfb","aqcssy","aqcswdb","clipboard","jldld","nativebridge","network","notification"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+    if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+        s1 = os.path.join(decompileDir, "smali_classes9", "com")
+        if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new, "com")
+            list_package = ["baitian"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
 
 if __name__ == "__main__":
     ""

+ 53 - 3
我的世界酷派/script.py

@@ -36,12 +36,62 @@ def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_chann
     sdk_id = channel_sdk_info['id']
     if sdk_id == "512" or sdk_id=="597":
         split(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info)
+
+        s1 = os.path.join(extract_dir, "smali_classes18", "com","facebook")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir, "com","facebook")
+        list_package = ["animated","binaryresource","cache","callercontext","common"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+        s1 = os.path.join(extract_dir, "smali_classes38", "com","facebook")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir, "com","facebook")
+        list_package = ["nativefilters","nativeimagetranscoder","perftest","proguard","react","soloader","systrace","webpsupport","widget"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+        s1 = os.path.join(extract_dir, "smali_classes39", "com")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir, "com")
+        list_package = ["oblador"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+        s1 = os.path.join(extract_dir, "smali_classes39", "com")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir, "com")
+        list_package = ["reactnativecommunity"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+        s1 = os.path.join(extract_dir, "smali_classes42", "androidx")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir, "androidx")
+        list_package = ["interpolator","legacy","loader","localbroadcastmanager","media","print"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+
     if sdk_id == "549":
         # smali_classes6
-        s1 = os.path.join(extract_dir, "smali_classes6", "com")
+        s1 = os.path.join(extract_dir, "smali_classes6")
         smali_classes2_dir = create_mutil_smali(extract_dir)
-        s3 = os.path.join(smali_classes2_dir, "com")
-        list_package = ["JavaWebsocket", "mp4parser", "reactnative", "reactnativecommunity"]
+        s3 = os.path.join(smali_classes2_dir)
+        list_package = ["com"]
+        if not os.path.exists(s3):
+            distutils.dir_util.mkpath(s3)
+        move_package(s1, s3, list_package)
+
+        s1 = os.path.join(extract_dir, "smali_classes5")
+        smali_classes2_dir = create_mutil_smali(extract_dir)
+        s3 = os.path.join(smali_classes2_dir)
+        list_package = ["com"]
         if not os.path.exists(s3):
             distutils.dir_util.mkpath(s3)
         move_package(s1, s3, list_package)

二进制
我的世界酷派/script.pyc


二进制
我的世界酷派/我的世界酷派.zip


+ 213 - 0
杜拉拉升职记酷派/script.py

@@ -0,0 +1,213 @@
+# coding:utf8
+
+__author__ = '灌篮高手酷派'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+
+import distutils.dir_util
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    return
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
+
+    if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+        s1 = os.path.join(decompileDir, "smali_classes19","com","haowanyou")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com","haowanyou")
+            list_package = ["router","sdkaes","sdkpermission","session","tool","tracepath","xmltojson"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+    if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new)
+            list_package = ["androidx"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["samsung","sdk","splash","tencent","twobigears","unionpay","unity","unity3d","wysd","ycsdk","yulong","yysg","zndroid","zui"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["google","haowanyou","huawei","hwy","ipaynow","jaredrummler","luoshihai","mob","netease","onevcat","push"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["luoshihai","mob","netease","onevcat","push"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["hwy","ipaynow","jaredrummler"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["haowanyou"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes4")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new)
+            list_package = ["com"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes5","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["faceunity","friendtime","friendtimes"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes7","androidx")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["appcompat","asynclayoutinflater","coordinatorlayout","cursoradapter","documentfile","fragment","arch","collection","core","customview","drawerlayout","interpolator"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["google","haowanyou","huawei","hwy","ipaynow","jaredrummler"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["google","huawei"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["hwy","ipaynow","jaredrummler"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com","haowanyou")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com","haowanyou")
+            list_package = ["application","channel","common","core","event","multibundle","react"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com","haowanyou")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com","haowanyou")
+            list_package = ["react_native","reactnative","router","sdkaes","sdkpermission","session","tool","tracepath","xmltojson"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["mob"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes16","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["haowanyou"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes20","com/haowanyou")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com/haowanyou")
+            list_package = ["application","channel","common","core","event","multibundle","react","react_native","reactnative"]
+            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 = 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)
+
+
+if __name__ == '__main__':
+    replace_life_method("D:\\work\\xmy")

+ 168 - 0
武林外传酷派/script.py

@@ -0,0 +1,168 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+
+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
+    sdk_id =  channel_sdk_info['id']
+    if sdk_id == "597" :#深圳 成都都是用这个id
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/layout-sw600dp/mtrl_layout_snackbar.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "mtrl_layout_snackbar")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar_include.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/drawable-v21/abc_dialog_material_background.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values/styles.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values-v21/styles.xml")
+        if os.path.exists(public_xml):
+            handle_public_xml(public_xml, "attr-private")
+
+    return
+
+
+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
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 1 - 14
率土之滨酷派/script.py

@@ -36,21 +36,11 @@ def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
 def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
     sdk_id = channelSdkInfo['id']
     if sdk_id == "597":
-        # f_idx = 3
-        # tmp = gw_file_system.get_full_path(os.path.join(decompileDir, 'smali_classes%d' % f_idx))
-        # tmp = tmp.replace('\\', '/')
-        # tmp = re.sub('/+', '/', tmp)
-        # androidx = tmp + '/androidx'
-        #
-        # if os.path.exists(androidx):
-        #     new_dex_dir = create_mutil_smali(decompileDir)
-        #     move_package(tmp, new_dex_dir, ["androidx"])
-        #
         move_androidx(decompileDir,"smali_classes3")
         move_androidx(decompileDir,"smali_classes4")
 
     # endwhile
-    if sdk_id == "549" or sdk_id == "591":
+    if sdk_id == "549" or sdk_id == "591" or sdk_id=="597":
         f_idx = 5
         # while True:
         tmp = gw_file_system.get_full_path(os.path.join(decompileDir, 'smali_classes%d' % f_idx))
@@ -64,9 +54,6 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
             move_package(androidx, dst, ["pharos", "stzb", "unisdk"])
             # break
 
-        # if not os.path.exists(tmp):
-        # break
-
     return
 
 

二进制
率土之滨酷派/script.pyc


二进制
率土之滨酷派/率土之滨酷派.zip


+ 9 - 0
王牌战争酷派/script.py

@@ -57,6 +57,15 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
                 distutils.dir_util.mkpath(s3)
             move_package(s1, s3, list_package)
 
+    if channelSdkInfo['id'] == '512' or channelSdkInfo['id'] == '589':
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["netease","qiniu","sina","squareup","tencent","thinking","unity3d","wechat","yingxiong"]
+            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

+ 190 - 0
菜鸟小忍者/script.py

@@ -0,0 +1,190 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+
+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
+    sdk_id =  channel_sdk_info['id']
+    if sdk_id == "597" :#深圳 成都都是用这个id
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
+        handle_public_xml(public_xml, "attr-private")
+        #
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar.xml")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/layout-sw600dp/mtrl_layout_snackbar.xml")
+        os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "mtrl_layout_snackbar")
+
+        public_xml = os.path.join(extract_dir, "res/layout/mtrl_layout_snackbar_include.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/drawable-v21/abc_dialog_material_background.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+        public_xml = os.path.join(extract_dir, "res/values-v21/styles.xml")
+        handle_public_xml(public_xml, "attr-private")
+
+    return
+
+
+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
+
+
+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)
+
+        s1 = os.path.join(decompileDir, "smali_classes2","com")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir, "com")
+            list_package = ["hg6kwan","hg6wan","huawei","ipaynow","merge","mobile","netease","nirvana","qq","samsung","snail","tencent","unionpay","yulong","zui"]
+
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+    if sdk_id=="549":
+        s1 = os.path.join(decompileDir, "smali")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir)
+            list_package = ["androidx"]
+
+            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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 305 - 0
萌猫保卫战酷派/script.py

@@ -0,0 +1,305 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+import gw_data_center
+
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
+
+def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+    # gw_data_center.pack_small=True
+    return
+
+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
+    if channel_sdk_info['id'] == '549':
+        # public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        # handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
+        #
+        #
+        # public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        # handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
+
+        # public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
+        # handle_public_xml(public_xml, "attr-private")
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
+        #
+        #
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_background_transition_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
+        handle_public_xml(public_xml, "abc_item_background_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
+        handle_public_xml(public_xml, "abc_list_selector_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
+        handle_public_xml(public_xml, "abc_item_background_holo_dark")
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_item_background_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_list_selector_background_transition_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_list_selector_holo_dark.xml")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_pressed_holo_dark.9.png")
+        logging.info("public_xml:"+public_xml)
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_pressed_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+
+        public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_selector_disabled_holo_dark.9.png")
+        if os.path.exists(public_xml):
+            os.remove(public_xml)
+    return
+
+
+
+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
+
+def script_after(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
+     if channel_sdk_info['id'] == '549':
+        logging.info("-----after info-----")
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
+        #
+        #
+        public_xml = os.path.join(extract_dir, "res/values/public.xml")
+        handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
+     logging.info("-----debug-----")
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    logging.info("-----debug-----")
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+
+   if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali_classes3")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new)
+            list_package = ["androidx"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes3","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["facebook","google","tencent","unity3d"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+
+        s1 = os.path.join(decompileDir, "smali_classes4","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["sigmob","ss","tan"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes4","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["google","iab","ihoc"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes4","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["mbridge","platformad","qq"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+   if channelSdkInfo['id'] == '591'  or  channelSdkInfo['id'] == '549':
+       s1 = os.path.join(decompileDir, "smali_classes5","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["fragment","legacy","loader","media","recyclerview"," swiperefreshlayout","versionedparcelable","interpolator","lifecycle","localbroadcastmanager","print","slidingpanelayout","vectordrawable","viewpager"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes5")
+       if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["fragment","legacy","loader","media","recyclerview"," swiperefreshlayout","versionedparcelable","interpolator","lifecycle","localbroadcastmanager","print","slidingpanelayout","vectordrawable","viewpager"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes9","com/mbridge/msdk")
+       if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["optimize","out","playercommon","pluginFramework","reward","rover","shake","shell","splash","system","thrid","video","videocommon","widget"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes9","com/mbridge/msdk")
+       if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["a","b","click","e","interstitial"," mbbanner","mbjscommon","nativex","activity","banner","d","f","interstitialvideo","mbbid","mbnative","newinterstitial","advanced","c","dycreator","foundation","intervideo","mbdownload","mbsignalcommon"]
+            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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 26 - 2
蛋仔派对酷派/script.py

@@ -39,7 +39,7 @@ def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
 
 def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
     sdk_id = channelSdkInfo['id']
-    if sdk_id == "597":
+    if sdk_id == "597" or sdk_id == "591" :
         s1 = os.path.join(decompileDir, "smali_classes4")
         if os.path.exists(s1):
             smali_classes2_dir = create_mutil_smali(decompileDir)
@@ -62,7 +62,31 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
             s3 = os.path.join(smali_classes2_dir,"com","netease")
             if not os.path.exists(s3):
                 distutils.dir_util.mkpath(s3)
-            move_package(s1, s3, ["mpay", "ngpush", "ntunisdk", "party", "unisdk"])
+            move_package(s1, s3, ["mpay", "ngpush", "ntunisdk"])
+
+        s1 = os.path.join(decompileDir, "smali_classes8","com","netease")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir,"com","netease")
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, ["party", "unisdk"])
+
+        s1 = os.path.join(decompileDir, "smali_classes8","com","netease")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir,"com","netease")
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, ["party", "unisdk"])
+
+        s1 = os.path.join(decompileDir, "smali_classes5","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, ["netease"])
 
     if sdk_id == "549" or sdk_id=="591":
         s1 = os.path.join(decompileDir, "smali_classes7", "com")

+ 79 - 1
诛仙百度/script.py

@@ -3,17 +3,95 @@ __author__ = 'Snow'
 
 import yaml
 import os
+import re
 import logging
 
+r_regex_str = r'sget[^\n]*R\$layout[^\n]*I|sget[^\n]*R\$id[^\n]*I|sget[^\n]*R\$drawable[^\n]*I|sget[^\n]*R\$string[^\n]*I'
+
+def findRSmaliAndReplace(smali_file_path, regex_str):
+    with open(smali_file_path, 'r') as f:
+        smali_str = f.read()
+        pattern = re.compile(regex_str)
+        resource_arr = pattern.findall(smali_str)
+        for r_str in resource_arr:
+            virtual_name = r_str[r_str.index(' ') + 1:r_str.index(',')]
+            print(virtual_name)
+            resource_type = r_str[r_str.index('R$') + 2:r_str.index(';')].capitalize()
+            print(resource_type)
+            resource_name = r_str[r_str.index('->') + 2:r_str.index(':')]
+            print(resource_name)
+            new_r_str = "const-string %s, \"%s\"\n\n\tinvoke-static {%s}, Lcom/kf/framework/MommyUtils;->get%sId(Ljava/lang/String;)I\n\n\tmove-result %s" % (
+                virtual_name, resource_name, virtual_name, resource_type, virtual_name)
+            print(new_r_str)
+            smali_str = smali_str.replace(r_str, new_r_str)
+    with open(smali_file_path, 'w') as f:
+        f.write(smali_str)
+
+
+def replaceRoseResource(d_dir):
+    for dirpath, dirnames, filenames in os.walk(d_dir):
+        if r'com\wm\shh\zx' in dirpath:
+            for smali_file in filenames:
+                smali_file_path = os.path.join(dirpath, smali_file)
+                print(smali_file_path)
+                findRSmaliAndReplace(smali_file_path, r_regex_str)
+        if r'com\wanmei\zhuxian' in dirpath and 'GameActivity.smali' in filenames:
+            smali_file_path = os.path.join(dirpath, "GameActivity.smali")
+            print(smali_file_path)
+            findRSmaliAndReplace(smali_file_path, r_regex_str)
+
+        if r'com\wanmei\zhuxian\qcloud\image' in dirpath and 'UpLoadImageActivity.smali' in filenames:
+            smali_file_path = os.path.join(dirpath, "UpLoadImageActivity.smali")
+            print(smali_file_path)
+            findRSmaliAndReplace(smali_file_path, r_regex_str)
+
+def isNeedReplaceApplicationLine(line):
+    return '.super Landroid/app/Application;' in line \
+           or 'invoke-direct {p0}, Landroid/app/Application;-><init>()V' in line \
+           or 'invoke-super {p0, p1}, Landroid/app/Application;->attachBaseContext(Landroid/content/Context;)V' in line \
+           or 'invoke-super {p0, p1}, Landroid/app/Application;->onConfigurationChanged(Landroid/content/res/Configuration;)V' in line \
+           or 'invoke-super {p0}, Landroid/app/Application;->onLowMemory()V' in line \
+           or 'invoke-super {p0}, Landroid/app/Application;->onTerminate()V' in line \
+           or 'invoke-super {p0, p1}, Landroid/app/Application;->onTrimMemory(I)V' in line \
+           or 'invoke-super {p0}, Landroid/app/Application;->onCreate()V' in line
+
+def is_kf_replace_application(line):
+    return '.super Lcom/kf/framework/KFApplication;' in line \
+           or 'invoke-direct {p0}, Lcom/kf/framework/KFApplication;-><init>()V' in line \
+           or 'invoke-super {p0, p1}, Lcom/kf/framework/KFApplication;->attachBaseContext(Landroid/content/Context;)V' in line \
+           or 'invoke-super {p0, p1}, Lcom/kf/framework/KFApplication;->onConfigurationChanged(Landroid/content/res/Configuration;)V' in line \
+           or 'invoke-super {p0}, Lcom/kf/framework/KFApplication;->onLowMemory()V' in line \
+           or 'invoke-super {p0}, Lcom/kf/framework/KFApplication;->onTerminate()V' in line \
+           or 'invoke-super {p0, p1}, Lcom/kf/framework/KFApplication;->onTrimMemory(I)V' in line \
+           or 'invoke-super {p0}, Lcom/kf/framework/KFApplication;->onCreate()V' in line
+
+def replace_application_verify_xmy_bug(decompile_dir):
+    for dirpath, dirnames, filenames in os.walk(decompile_dir):
+        if r'com\pwrd\onesdk\onesdkcommon\onesdkapplication' in dirpath and 'OneSDKApplication.smali' in filenames:
+            application_path = os.path.join(dirpath, "OneSDKApplication.smali")
+            print(application_path)
+            with open(application_path, "r") as f:
+                smali_str_arr = f.readlines()
+                for line in smali_str_arr:
+                    if not is_kf_replace_application(line) and 'Lcom/kf/framework/KFApplication' in line:
+                        smali_str_arr[smali_str_arr.index(line)] = line.replace('Lcom/kf/framework/KFApplication',
+                                                                                'Landroid/app/Application')
+                    if isNeedReplaceApplicationLine(line):
+                        smali_str_arr[smali_str_arr.index(line)] = line.replace('Landroid/app/Application',
+                                                                                'Lcom/kf/framework/KFApplication')
+            with open(application_path, "w") as f:
+                f.write(''.join(smali_str_arr))
+
 
 def meta_constructor(loader, node):
     value = loader.construct_mapping(node)
     return value
 
 
-
 def script_last(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
     logging.info('game_pack_info: ' + str(channel_sdk_info))
+    replace_application_verify_xmy_bug(extract_dir)
+    replaceRoseResource(extract_dir)
     # 冰狐渠道id 521
     # 遥望渠道id 412
     # 齐齐乐渠道id 234

+ 174 - 0
都市英豪酷派/script.py

@@ -0,0 +1,174 @@
+# coding:utf8
+
+__author__ = 'dong'
+
+import os
+import logging
+import xml.dom.minidom
+import re
+import shutil
+import glob
+from xml.etree.ElementTree import ElementTree, Element
+import distutils.dir_util
+from xml.etree import ElementTree as ET
+import gw_file_system
+
+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
+    decompileDir=extract_dir
+    if channel_sdk_info['id'] == '597':
+
+        delete_file_path = os.path.join(extract_dir, "res/mipmap-mdpi/ic_launcher.webp")
+        delete_file(delete_file_path)
+
+        delete_file_path = os.path.join(extract_dir, "res/mipmap-hdpi/ic_launcher.webp")
+        delete_file(delete_file_path)
+
+        delete_file_path = os.path.join(extract_dir, "res/mipmap-xhdpi/ic_launcher.webp")
+        delete_file(delete_file_path)
+
+        delete_file_path = os.path.join(extract_dir, "res/mipmap-xxhdpi/ic_launcher.webp")
+        delete_file(delete_file_path)
+
+        delete_file_path = os.path.join(extract_dir, "res/mipmap-xxxhdpi/ic_launcher.webp")
+        delete_file(delete_file_path)
+
+
+    return
+
+
+def delete_file(file):
+    if not os.path.exists(file):
+        logging.info('public_xml is null: ' +file)
+        return
+    os.remove(file)
+    return
+
+
+def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    return
+
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+    if channelSdkInfo['id'] == '597':
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["blankj","bumptech","bun","companyname","coolpad"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["game","github","google"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com","hzwx")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com","hzwx")
+            list_package = ["am","android","androidutil","auto"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes9","com","hzwx")
+        if os.path.exists(s1):
+            smali_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com","hzwx")
+            list_package = ["diy","fx","lib","sy","wx"]
+            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)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    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:
+            # providerName = provider.attrib.get(name)
+            # if 'com.netease.ntunisdk.CcMomentRecordingForegroundService' == providerName:
+            # 使用try 主要是为了 防止此属性不在时,导致的错误,而程序终止
+            try:
+                del provider.attrib[authorities]
+            except:
+                ""
+
+    root_node.write(xmlparse, 'utf-8')
+
+
+if __name__ == '__main__':
+    # replace_super_application("D:\work\wzdq")
+    modify_manifest("E:\\apk\\youhua\\youhua.zip.out", "requestLegacyExternalStorage")

+ 29 - 0
镇魂街:天生为王酷派/script.py

@@ -77,6 +77,15 @@ def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
 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_classes_new = create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["activity","appcompat","collection","core","customview","exifinterface","interpolator","lifecycle","annotation","arch","constraintlayout","cursoradapter","drawerlayout","fragment","legacy","loader"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
         s1 = os.path.join(decompileDir, "smali_classes2")
         if os.path.exists(s1):
             smali_classes2_dir = create_mutil_smali(decompileDir)
@@ -464,6 +473,26 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
             if not os.path.exists(s3):
                 distutils.dir_util.mkpath(s3)
             move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes7","com")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir,)
+            list_package = []
+            list_package.extend(["facebook","google","heytap"])
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
+
+        s1 = os.path.join(decompileDir, "smali_classes7","com")
+        if os.path.exists(s1):
+            smali_classes2_dir = create_mutil_smali(decompileDir)
+            s3 = os.path.join(smali_classes2_dir,)
+            list_package = []
+            list_package.extend(["hihonor","huawei"])
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            move_package(s1, s3, list_package)
     return
 
 def create_mutil_smali(decompileDir):

+ 111 - 0
魔域手游2酷派/script.py

@@ -0,0 +1,111 @@
+# coding:utf8
+
+__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
+
+
+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)
+    # if channelSdkInfo['id'] == '549':
+        # del_qihoo(decompileDir)
+        # gw_apk_tool.yml_remove_uncompress(decompileDir)
+
+def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
+   if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
+       s1 = os.path.join(decompileDir, "smali_classes4","com")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"com")
+            list_package = ["onevcat","RenderHeads","seasun","tencent","twobigears","unionpay","unity3d","vmadalin","xsj","yulong"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+
+   if channelSdkInfo['id'] == '597':
+       s1 = os.path.join(decompileDir, "smali_classes2","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes3","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes4","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes2","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes3","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+       s1 = os.path.join(decompileDir, "smali_classes4","androidx")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
+            list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+       s1 = os.path.join(decompileDir, "smali_classes4")
+       if os.path.exists(s1):
+            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
+            s3 = os.path.join(decompileDir, smali_classes_new)
+            list_package = ["androidx"]
+            if not os.path.exists(s3):
+                distutils.dir_util.mkpath(s3)
+            gw_apk_tool.move_package(s1, s3, list_package)
+
+def remove_navigate(decompileDir):
+    tmp_res = os.path.join(decompileDir, "res", "navigation")
+    tmp_public_xml = os.path.join(decompileDir, "res", "values", "public.xml")
+    if os.path.exists(tmp_res):
+        distutils.dir_util.remove_tree(tmp_res)
+    if os.path.exists(tmp_public_xml):
+        os.remove(tmp_public_xml)
+
+
+if __name__ == '__main__':
+    # del_qihoo("C:\\Users\\Administrator\\Desktop\\zt")
+    remove_navigate("G:\\autopack2.0_kuaifa\\tool\\workspace\\lrs360\\13651\\extract")