Преглед изворни кода

allowNativeHeapPointerTagging
找不到

DONGGUOLIANGNEW\edy пре 2 година
родитељ
комит
df7d06dc49
1 измењених фајлова са 48 додато и 2 уклоњено
  1. 48 2
      新笑傲江湖酷派/script.py

+ 48 - 2
新笑傲江湖酷派/script.py

@@ -8,10 +8,12 @@ import xml.dom.minidom
 import re
 import shutil
 import glob
+from xml.etree import ElementTree as ET
 
+ANDROID_NS = 'http://schemas.android.com/apk/res/android'
 
-def script_second(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
 
+def script_second(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
     if channelSdkInfo['id'] == '587':
         progress_png = os.path.join(decompileDir, "res/drawable/progress.png")
         if os.path.exists(progress_png):
@@ -23,7 +25,9 @@ def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameIn
     logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
     if channelSdkInfo['id'] == '549':
         del_coolcloud(decompileDir)
-        replace_Theme(decompileDir)
+        # replace_Theme(decompileDir)
+    if channelSdkInfo['id'] == '597':
+        modify_manifest_common(decompileDir, "allowNativeHeapPointerTagging")
 
 
 def del_coolcloud(decompileDir):
@@ -48,5 +52,47 @@ def replace_Theme(extract_dir):
             tf.write(cont)
 
 
+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 modify_manifest_common(decompileDir, removeKey):
+    ET.register_namespace('android', ANDROID_NS)
+    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
+    logging.info(xmlparse)
+    root_node = ET.parse(xmlparse)
+    root = root_node.getroot()
+    name = '{' + ANDROID_NS + '}name'
+    authorities = '{' + ANDROID_NS + '}' + removeKey
+    package_name = root.attrib.get('package')
+    if package_name == None:
+        return
+    providers = root.findall('./application')
+    if providers != None:
+        for provider in providers:
+            # 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__':
     del_coolcloud("C:\\Users\\Administrator\\Desktop\\Shadow")