| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- # 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")
|