def obfuscate(): """ The main obfuscator function """ try: res_xml = u.load_res_repository() # Load the 'pulbic.xml' resource repository except e.FileNotFound: return res_root = res_xml.getroot() # The root of the XML file edited_res = set( list(change_all_res(res_root)) + list(change_meta(u.load_manifest().getroot())) ) u.save_res_repository(res_xml) # Save the 'pulbic.xml' resource repository back to file change_all_res_file(u.load_xml_file(), edited_res) change_allfile(u.load_resource_file(), edited_res) try: res_xml = u.load_res_repository() # Load the 'pulbic.xml' resource repository except e.FileNotFound: return item_id_list = list(add_id_random_resource(res_root)) u.save_res_repository(res_xml) # Save the 'pulbic.xml' resource repository back to file ids_xml = fix_ids(u.load_res_id_repository()) # Load the 'ids.xml' resource repository ids_root = ids_xml.getroot() # The root of the XML file add_id_random_in_ids(ids_root, item_id_list) u.save_ids_repository(ids_xml) # Save the 'ids.xml' resource repository back to file append_defunct_class()
def obfuscate(): """ The main obfuscator function """ try: res_xml = u.load_res_repository( ) # Load the 'pulbic.xml' resource repository except e.FileNotFound: return res_root = res_xml.getroot() # The root of the XML file edited_res = set( list(change_all_res(res_root)) + list(change_meta(u.load_manifest().getroot()))) u.save_res_repository( res_xml) # Save the 'pulbic.xml' resource repository back to file change_all_res_file(u.load_xml_file(), edited_res) change_allfile(u.load_resource_file(), edited_res) try: res_xml = u.load_res_repository( ) # Load the 'pulbic.xml' resource repository except e.FileNotFound: return item_id_list = list(add_id_random_resource(res_root)) u.save_res_repository( res_xml) # Save the 'pulbic.xml' resource repository back to file ids_xml = fix_ids( u.load_res_id_repository()) # Load the 'ids.xml' resource repository ids_root = ids_xml.getroot() # The root of the XML file add_id_random_in_ids(ids_root, item_id_list) u.save_ids_repository( ids_xml) # Save the 'ids.xml' resource repository back to file append_defunct_class()
def fix_ids(res_ids): """Apply a fix if the file 'ids.xml' does not exist""" if res_ids is None: res_ids = u.move_ids_xml() res_ids = u.load_res_id_repository() return res_ids