script.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. # coding:utf8
  2. __author__ = 'dong'
  3. import os
  4. import logging
  5. import xml.dom.minidom
  6. import re
  7. import shutil
  8. import glob
  9. import distutils.dir_util
  10. import os
  11. import gw_apk_tool
  12. def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  13. logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
  14. if channelSdkInfo['id'] == '597':
  15. logging.info("remove_navigate")
  16. remove_navigate(decompileDir)
  17. # if channelSdkInfo['id'] == '549':
  18. # del_qihoo(decompileDir)
  19. # gw_apk_tool.yml_remove_uncompress(decompileDir)
  20. def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  21. if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
  22. s1 = os.path.join(decompileDir, "smali_classes4","com")
  23. if os.path.exists(s1):
  24. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  25. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  26. list_package = ["onevcat","RenderHeads","seasun","tencent","twobigears","unionpay","unity3d","vmadalin","xsj","yulong"]
  27. if not os.path.exists(s3):
  28. distutils.dir_util.mkpath(s3)
  29. gw_apk_tool.move_package(s1, s3, list_package)
  30. s1 = os.path.join(decompileDir, "smali_classes4","com")
  31. if os.path.exists(s1):
  32. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  33. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  34. list_package = ["google","nd"]
  35. if not os.path.exists(s3):
  36. distutils.dir_util.mkpath(s3)
  37. gw_apk_tool.move_package(s1, s3, list_package)
  38. if channelSdkInfo['id'] == '597':
  39. s1 = os.path.join(decompileDir, "smali_classes2","androidx")
  40. if os.path.exists(s1):
  41. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  42. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  43. list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
  44. if not os.path.exists(s3):
  45. distutils.dir_util.mkpath(s3)
  46. gw_apk_tool.move_package(s1, s3, list_package)
  47. s1 = os.path.join(decompileDir, "smali_classes3","androidx")
  48. if os.path.exists(s1):
  49. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  50. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  51. list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
  52. if not os.path.exists(s3):
  53. distutils.dir_util.mkpath(s3)
  54. gw_apk_tool.move_package(s1, s3, list_package)
  55. s1 = os.path.join(decompileDir, "smali_classes4","androidx")
  56. if os.path.exists(s1):
  57. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  58. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  59. list_package = ["security","tracing","work","appcompat","cardview","coordinatorlayout","drawerlayout","navigation","sqlite","transition","arch","collection","core","emoji2","room","startup","viewpager2"]
  60. if not os.path.exists(s3):
  61. distutils.dir_util.mkpath(s3)
  62. gw_apk_tool.move_package(s1, s3, list_package)
  63. s1 = os.path.join(decompileDir, "smali_classes2","androidx")
  64. if os.path.exists(s1):
  65. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  66. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  67. list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
  68. if not os.path.exists(s3):
  69. distutils.dir_util.mkpath(s3)
  70. gw_apk_tool.move_package(s1, s3, list_package)
  71. s1 = os.path.join(decompileDir, "smali_classes3","androidx")
  72. if os.path.exists(s1):
  73. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  74. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  75. list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
  76. if not os.path.exists(s3):
  77. distutils.dir_util.mkpath(s3)
  78. gw_apk_tool.move_package(s1, s3, list_package)
  79. s1 = os.path.join(decompileDir, "smali_classes4","androidx")
  80. if os.path.exists(s1):
  81. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  82. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  83. list_package = ["inspection","loader","print","swiperefreshlayout","webkit","asynclayoutinflater","cursoradapter","interpolator","localbroadc","astmanager","recyclerview","vectordrawable","browser","customview","legacy","media","savedstate","versionedparcelable"]
  84. if not os.path.exists(s3):
  85. distutils.dir_util.mkpath(s3)
  86. gw_apk_tool.move_package(s1, s3, list_package)
  87. s1 = os.path.join(decompileDir, "smali_classes4")
  88. if os.path.exists(s1):
  89. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  90. s3 = os.path.join(decompileDir, smali_classes_new)
  91. list_package = ["androidx"]
  92. if not os.path.exists(s3):
  93. distutils.dir_util.mkpath(s3)
  94. gw_apk_tool.move_package(s1, s3, list_package)
  95. s1 = os.path.join(decompileDir, "smali","androidx")
  96. if os.path.exists(s1):
  97. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  98. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  99. list_package = ["activity","collection","documentfile","legacy","print","startup","viewpager2"]
  100. if not os.path.exists(s3):
  101. distutils.dir_util.mkpath(s3)
  102. gw_apk_tool.move_package(s1, s3, list_package)
  103. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  104. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  105. list_package = ["annotation","concurrent","drawerlayout","lifecycle","recyclerview","swiperefreshlayout","webkit"]
  106. if not os.path.exists(s3):
  107. distutils.dir_util.mkpath(s3)
  108. gw_apk_tool.move_package(s1, s3, list_package)
  109. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  110. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  111. list_package = ["appcompat","constraintlayout","dynamicanimation","loader","resourceinspection","tracing","work"]
  112. if not os.path.exists(s3):
  113. distutils.dir_util.mkpath(s3)
  114. gw_apk_tool.move_package(s1, s3, list_package)
  115. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  116. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  117. list_package = ["appcompat","constraintlayout","dynamicanimation","loader","resourceinspection","tracing","work"]
  118. if not os.path.exists(s3):
  119. distutils.dir_util.mkpath(s3)
  120. gw_apk_tool.move_package(s1, s3, list_package)
  121. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  122. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  123. list_package = ["arch","coordinatorlayout","emoji2","localbroadcastmanager","room","transition"]
  124. if not os.path.exists(s3):
  125. distutils.dir_util.mkpath(s3)
  126. gw_apk_tool.move_package(s1, s3, list_package)
  127. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  128. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  129. list_package = ["asynclayoutinflater","core","fragment","media","savedstate","vectordrawable"]
  130. if not os.path.exists(s3):
  131. distutils.dir_util.mkpath(s3)
  132. gw_apk_tool.move_package(s1, s3, list_package)
  133. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  134. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  135. list_package = ["browser","cursoradapter","inspection","multidex","slidingpanelayout","versionedparcelable"]
  136. if not os.path.exists(s3):
  137. distutils.dir_util.mkpath(s3)
  138. gw_apk_tool.move_package(s1, s3, list_package)
  139. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  140. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  141. list_package = ["cardview","customview","interpolator","navigation","sqlite","viewpager"]
  142. if not os.path.exists(s3):
  143. distutils.dir_util.mkpath(s3)
  144. gw_apk_tool.move_package(s1, s3, list_package)
  145. s1 = os.path.join(decompileDir, "smali_classes2","com")
  146. if os.path.exists(s1):
  147. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  148. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  149. list_package = ["lh"]
  150. if not os.path.exists(s3):
  151. distutils.dir_util.mkpath(s3)
  152. gw_apk_tool.move_package(s1, s3, list_package)
  153. s1 = os.path.join(decompileDir, "smali_classes2","com")
  154. if os.path.exists(s1):
  155. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  156. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  157. list_package = ["lh"]
  158. if not os.path.exists(s3):
  159. distutils.dir_util.mkpath(s3)
  160. gw_apk_tool.move_package(s1, s3, list_package)
  161. s1 = os.path.join(decompileDir, "smali_classes2","com")
  162. if os.path.exists(s1):
  163. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  164. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  165. list_package = ["nd","tencent"]
  166. if not os.path.exists(s3):
  167. distutils.dir_util.mkpath(s3)
  168. gw_apk_tool.move_package(s1, s3, list_package)
  169. s1 = os.path.join(decompileDir, "smali_classes2","com")
  170. if os.path.exists(s1):
  171. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  172. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  173. list_package = ["kingsoft"]
  174. if not os.path.exists(s3):
  175. distutils.dir_util.mkpath(s3)
  176. gw_apk_tool.move_package(s1, s3, list_package)
  177. sdk_id = channelSdkInfo['id']
  178. if sdk_id == "597":
  179. move(decompileDir)
  180. else:
  181. move_smallsheep(decompileDir)
  182. def remove_navigate(decompileDir):
  183. tmp_res = os.path.join(decompileDir, "res", "navigation")
  184. tmp_public_xml = os.path.join(decompileDir, "res", "values", "public.xml")
  185. if os.path.exists(tmp_res):
  186. distutils.dir_util.remove_tree(tmp_res)
  187. if os.path.exists(tmp_public_xml):
  188. os.remove(tmp_public_xml)
  189. def move_smallsheep(decompileDir):
  190. s1 = os.path.join(decompileDir, "smali_classes12/com")
  191. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  192. s3 = os.path.join(decompileDir, smali_classes_new)
  193. list_package = ["onevcat","RenderHeads","tencent"]
  194. if not os.path.exists(s3):
  195. distutils.dir_util.mkpath(s3)
  196. gw_apk_tool.move_package(s1, s3, list_package)
  197. s1 = os.path.join(decompileDir, "smali_classes4/com")
  198. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  199. s3 = os.path.join(decompileDir, smali_classes_new)
  200. list_package = ["jssy"]
  201. if not os.path.exists(s3):
  202. distutils.dir_util.mkpath(s3)
  203. gw_apk_tool.move_package(s1, s3, list_package)
  204. def move(decompileDir):
  205. s1 = os.path.join(decompileDir, "smali_classes3")
  206. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  207. s3 = os.path.join(decompileDir, smali_classes_new)
  208. list_package = ["androidx"]
  209. if not os.path.exists(s3):
  210. distutils.dir_util.mkpath(s3)
  211. gw_apk_tool.move_package(s1, s3, list_package)
  212. s1 = os.path.join(decompileDir, "smali_classes3/com")
  213. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  214. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  215. list_package = ["google","nd","onevcat","RenderHeads","tencent"]
  216. if not os.path.exists(s3):
  217. distutils.dir_util.mkpath(s3)
  218. gw_apk_tool.move_package(s1, s3, list_package)
  219. s1 = os.path.join(decompileDir, "smali_classes4/com")
  220. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  221. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  222. list_package = ["google"]
  223. if not os.path.exists(s3):
  224. distutils.dir_util.mkpath(s3)
  225. gw_apk_tool.move_package(s1, s3, list_package)
  226. s1 = os.path.join(decompileDir, "smali_classes4/com")
  227. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  228. s3 = os.path.join(decompileDir, smali_classes_new,"com")
  229. list_package = ["iflytek"]
  230. if not os.path.exists(s3):
  231. distutils.dir_util.mkpath(s3)
  232. gw_apk_tool.move_package(s1, s3, list_package)
  233. s1 = os.path.join(decompileDir, "smali_classes5/androidx")
  234. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  235. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  236. list_package = ["navigation","room","sqlite","startup","tracing","transition","viewpager2","work"]
  237. if not os.path.exists(s3):
  238. distutils.dir_util.mkpath(s3)
  239. gw_apk_tool.move_package(s1, s3, list_package)
  240. s1 = os.path.join(decompileDir, "smali_classes6/androidx")
  241. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  242. s3 = os.path.join(decompileDir, smali_classes_new,"androidx")
  243. list_package = ["media","print","recyclerview","savedstate","swiperefreshlayout","vectordrawable","versionedparcelable","webkit"]
  244. if not os.path.exists(s3):
  245. distutils.dir_util.mkpath(s3)
  246. gw_apk_tool.move_package(s1, s3, list_package)
  247. if __name__ == '__main__':
  248. # del_qihoo("C:\\Users\\Administrator\\Desktop\\zt")
  249. remove_navigate("G:\\autopack2.0_kuaifa\\tool\\workspace\\lrs360\\13651\\extract")