Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import zipfile
- import shutil
- path = '/Users/arturmiasnykov/downloads/testpy'
- my_fonts = []
- for i in os.listdir(path):
- if 'ipa' in i:
- build_name_path = path + '/' + i
- with zipfile.ZipFile(build_name_path, 'r') as zip_ref:
- zip_ref.extractall(path)
- for root, dirs, files in os.walk(path):
- for file in files:
- #print(os.path.join(root,file))
- if 'ttf' in os.path.join(root,file):
- if file not in my_fonts:
- my_fonts.append(os.path.join(root,file))
- if 'fnt' in os.path.join(root, file):
- if file not in my_fonts:
- my_fonts.append(os.path.join(root, file))
- with open(os.path.join(root, file), 'rb') as f:
- f.seek(0)
- first_bytes = f.read(4)
- hex_bytes = " ".join(['{:02X}'.format(byte) for byte in first_bytes])
- if hex_bytes == '50 4B 03 04' or hex_bytes == '50 4B 05 06' or hex_bytes == '50 4B 07 08':
- with zipfile.ZipFile(os.path.join(root, file), 'r') as zip_ref:
- zip_ref.extractall('/Users/arturmiasnykov/Downloads/testpy/unarchieved')
- for i in my_fonts:
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement