Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. import os
  2. import zipfile
  3. import shutil
  4.  
  5. path = '/Users/arturmiasnykov/downloads/testpy'
  6. my_fonts = []
  7.  
  8.  
  9. for i in os.listdir(path):
  10.     if 'ipa' in i:
  11.         build_name_path = path + '/' + i
  12.  
  13. with zipfile.ZipFile(build_name_path, 'r') as zip_ref:
  14.     zip_ref.extractall(path)
  15.  
  16. for root, dirs, files in os.walk(path):
  17.     for file in files:
  18.         #print(os.path.join(root,file))
  19.         if 'ttf' in os.path.join(root,file):
  20.             if file not in my_fonts:
  21.                 my_fonts.append(os.path.join(root,file))
  22.         if 'fnt' in os.path.join(root, file):
  23.             if file not in my_fonts:
  24.                 my_fonts.append(os.path.join(root, file))
  25.         with open(os.path.join(root, file), 'rb') as f:
  26.             f.seek(0)
  27.             first_bytes = f.read(4)
  28.             hex_bytes = " ".join(['{:02X}'.format(byte) for byte in first_bytes])
  29.             if hex_bytes == '50 4B 03 04' or hex_bytes == '50 4B 05 06' or hex_bytes == '50 4B 07 08':
  30.                 with zipfile.ZipFile(os.path.join(root, file), 'r') as zip_ref:
  31.                     zip_ref.extractall('/Users/arturmiasnykov/Downloads/testpy/unarchieved')
  32.  
  33.  
  34. for i in my_fonts:
  35.     print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement