-
-
Save MeBlackHat/d80eee53e2e90272d21da1822d3eeca7 to your computer and use it in GitHub Desktop.
Download iOS Headers from http://developer.limneos.net. Includes settings for iOS version, download path and only downloading select frameworks.
This file contains 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
from lxml import html | |
import requests | |
import re | |
import os | |
def createDir(path): | |
if not os.path.exists(path): os.makedirs(path) | |
# Settings | |
iosVersion = "14.4" | |
downloadOnly = ["SpringBoard", "NotificationCenter", "UserNotifications", "UserNotificationsKit", "UserNotificationsServer", "UserNotificationsUI", "UserNotificationsUIKit"] | |
downloadPath = "./Headers" | |
mainPageLink = "http://developer.limneos.net/index.php?ios={}" | |
downloadPageLink = "http://developer.limneos.net/headers/{}/{}/Headers/{}" | |
frameworkLinkRegex = "\?ios=.*&framework=(.*)" | |
headerLinkRegex = "\?ios=.*&framework=.*&header=(.*)" | |
main = mainPageLink.format(iosVersion) | |
page = requests.get(main, verify=False) | |
tree = html.fromstring(page.content) | |
frameworks = tree.xpath('/html/body/div[@id="container"]/div/a/@href') | |
headerDownloads = [] | |
for frameworkLink in frameworks: | |
frameworkName = re.search(frameworkLinkRegex, frameworkLink) | |
frameworkName = frameworkName.group(1) if frameworkName is not None else None | |
if frameworkName.replace(".framework", "") not in downloadOnly and len(downloadOnly) != 0: continue | |
frameworkPage = requests.get(main.split("?")[0] + frameworkLink, verify=False) | |
frameworkTree = html.fromstring(frameworkPage.content) | |
headers = frameworkTree.xpath('/html/body/div[@id="container"]/div/a/@href') | |
for headerLink in headers: | |
headerFileName = re.search(headerLinkRegex, headerLink) | |
headerFileName = headerFileName.group(1) if headerFileName is not None else None | |
if headerFileName is None: continue | |
headerDownloads.append([frameworkName, headerFileName]) | |
numOfDownloads = len(headerDownloads) | |
maxDigits = str(len(str(numOfDownloads))) | |
progressStringFormat = "{:" + maxDigits + "d}/{:" + maxDigits + "d}" | |
stringFormat = "(" + progressStringFormat + ") {:13}:{} - {}" | |
for i in range(len(headerDownloads)): | |
download = headerDownloads[i] | |
downloadLink = downloadPageLink.format(iosVersion, download[0], download[1]) | |
savePath = os.path.join(downloadPath, download[0], download[1]) | |
if os.path.isfile(savePath): | |
print(stringFormat.format(i, numOfDownloads, "Skipping", download[0], download[1])); | |
continue | |
else: | |
createDir(os.path.join(downloadPath, download[0])) | |
print(stringFormat.format(i, numOfDownloads, "Downloading", download[0], download[1])); | |
r = requests.get(downloadLink, verify=False) | |
with open(savePath, 'wb') as out: | |
out.write(r.content) |
what a lovely script!! ヽ(♡‿♡)ノ to get rid of the warnings, add this up top:
import urllib3
urllib3.disable_warnings()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed SSLError : certificate verify failed
Make use you install lxml using,
pip3 install lxml
OG code by @menushka