script.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. import gw_data_center
  13. def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  14. # if channelSdkInfo['id'] == '597':
  15. # gw_data_center.pack_small = True
  16. return
  17. def script_second(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  18. return
  19. def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  20. # logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
  21. # if channelSdkInfo['id'] == '597':
  22. # logging.info("remove_navigate")
  23. # remove_navigate(decompileDir)
  24. return
  25. def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
  26. logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
  27. if channelSdkInfo['id'] == '597':
  28. move(decompileDir)
  29. else:
  30. ""
  31. def move(decompileDir):
  32. s1 = os.path.join(decompileDir, "smali/androidx")
  33. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  34. s3 = os.path.join(decompileDir, smali_classes_new, "androidx")
  35. list_package = ["activity","arch","coordinatorlayout","customview","fragment","lifecycle","annotation","asynclayoutinflater","core","documentfile","interpolator","loader","appcompat","collection","cursoradapter","drawerlayout","legacy","localbroadcastmanager"]
  36. if not os.path.exists(s3):
  37. distutils.dir_util.mkpath(s3)
  38. gw_apk_tool.move_package(s1, s3, list_package)
  39. def remove_navigate(decompileDir):
  40. tmp_res = os.path.join(decompileDir, "res", "navigation")
  41. tmp_public_xml = os.path.join(decompileDir, "res", "values", "public.xml")
  42. if os.path.exists(tmp_res):
  43. distutils.dir_util.remove_tree(tmp_res)
  44. if os.path.exists(tmp_public_xml):
  45. os.remove(tmp_public_xml)
  46. def move_10_bytedance(decompileDir):
  47. s1 = os.path.join(decompileDir, "smali_classes10/com/bytedance")
  48. smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
  49. s3 = os.path.join(decompileDir, smali_classes_new, "com/bytedance")
  50. list_package = ["ttgame"]
  51. if not os.path.exists(s3):
  52. distutils.dir_util.mkpath(s3)
  53. gw_apk_tool.move_package(s1, s3, list_package)
  54. def handle_public_xml(public_xml_path, remove_node):
  55. if not os.path.exists(public_xml_path):
  56. logging.info('public_xml is null: ' + public_xml_path)
  57. return
  58. new_lines = []
  59. with open(public_xml_path, 'r+') as f:
  60. for line in f.readlines():
  61. # l = line.strip()
  62. if line.find(remove_node) > -1:
  63. continue
  64. new_lines.append(line)
  65. f.seek(0)
  66. f.truncate()
  67. f.writelines(new_lines)
  68. return
  69. if __name__ == '__main__':
  70. # del_qihoo("C:\\Users\\Administrator\\Desktop\\zt")
  71. remove_navigate("G:\\autopack2.0_kuaifa\\tool\\workspace\\lrs360\\13651\\extract")