Created
May 18, 2012 15:03
-
-
Save rjw57/2725749 to your computer and use it in GitHub Desktop.
Extract all firmware URLs from the Apple iDevice firmware list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
from __future__ import print_function | |
import logging | |
import urllib2 | |
import plistlib | |
import sys | |
log = logging.getLogger() | |
FIRMWARE_SRC = 'http://itunes.apple.com/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version' | |
def fetch_firmware_locations(): | |
log.info('Fetching firmware description from {}.'.format(FIRMWARE_SRC)) | |
plist = plistlib.readPlist(urllib2.urlopen(FIRMWARE_SRC)) | |
return plist | |
def extract_firmwares(data): | |
if not isinstance(data, dict): | |
return | |
if 'FirmwareURL' in data: | |
url = data['FirmwareURL'].strip() | |
if url != 'EMPTY' and url != '': | |
print(url) | |
for v in data.itervalues(): | |
extract_firmwares(v) | |
def main(): | |
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stderr)) | |
logging.getLogger().setLevel(logging.INFO if '-q' not in sys.argv else logging.WARNING) | |
extract_firmwares(fetch_firmware_locations()) | |
if __name__ == '__main__': | |
main() | |
# vim:sw=4:sts=4:et |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment