Skip to content

Instantly share code, notes, and snippets.

@leo60228
Last active October 25, 2024 22:06
Show Gist options
  • Save leo60228/8ef5db08bdd6c5f8c3fa67b6d465ae32 to your computer and use it in GitHub Desktop.
Save leo60228/8ef5db08bdd6c5f8c3fa67b6d465ae32 to your computer and use it in GitHub Desktop.
import libarchive
import requests
import pycdlib
import httpio
print('querying redirect')
url = "https://archive.org/download/microsoft-office-professional-plus-2007/Microsoft%20Office%20Professional%20Plus%202007.iso"
target = requests.head(url).headers['Location']
print('making request')
iso_fp = httpio.open(target, block_size=4*1024*1024)
print('opening iso')
iso = pycdlib.PyCdlib()
iso.open_fp(iso_fp)
print('opening file')
with iso.open_file_from_iso(iso_path='/PROPLUSW/PROPLSWW.CAB') as cab_fp:
print('reading archive')
with libarchive.stream_reader(cab_fp) as archive:
print('archive loaded')
for entry in archive:
if entry.name.endswith('.TTF'):
print(entry.name)
with open(entry.name, 'wb') as out:
for block in entry.get_blocks():
out.write(block)
if entry.name == "WINGDNG3.TTF":
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment