| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- # coding:utf8
- import os
- import logging
- import re
- import glob
- import shutil
- import xml.etree.ElementTree as ET
- import distutils.dir_util
- import gw_file_system
- ANDROID_NS = 'http://schemas.android.com/apk/res/android'
- def script(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
- 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))
- return
- def script_pre(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
- return
- def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
- logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
- if not os.path.exists(os.path.join(decompileDir, "smali_classes3/androidx")):
- return
- s1 = os.path.join(decompileDir, "smali_classes3")
- smali_classes2_dir = create_mutil_smali(decompileDir)
- s3 = smali_classes2_dir
- list_package = ["androidx"]
- if not os.path.exists(s3):
- distutils.dir_util.mkpath(s3)
- move_package(s1, s3, list_package)
- 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):
- files = os.listdir(tmp)
- if len(files) == 0:
- smali_classes2_dir = tmp
- break
- f_idx += 1
- else:
- smali_classes2_dir = tmp
- break
- # endwhile
- if not os.path.exists(smali_classes2_dir):
- os.mkdir(smali_classes2_dir)
- return smali_classes2_dir
- def handle_public_xml_param(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 handle_public_xml(public_xml_path):
- 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("offline_banners") > -1 or line.find("outfit7") > -1 or line.find(
- "countries") > -1 or line.find(
- "county_codes") > -1 or line.find("felis_error_reporting_files") > -1:
- continue
- new_lines.append(line)
- f.seek(0)
- f.truncate()
- f.writelines(new_lines)
- return
- 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__':
- script_last("/tmp/ss", "G:/autopack2.0_kuaifa/tool/workspace/wdajl/15957/extract/", {"id": "309"}, "", "")
- # xml_path = "E:/apk/youhua/jingmenfengyue_216122/res/values/public.xml"
- # handle_public_xml(xml_path)
- # hideSplash("/mnt/share/yanghuang/python_test/cr")
|