Skip to content

Commit

Permalink
Version 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amadejpapez authored Feb 3, 2021
1 parent 24ad508 commit 2bbcc95
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions ApplSec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


updatesPage = requests.get("https://support.apple.com/en-us/HT201222").text
# currentDate = str(date.today().day) + " " + str(date.today().strftime('%B')[0:3]) + " " + str(date.today().year)
# currentDate = str(date.today().day) + " " + str(date.today().strftime("%B")[0:3]) + " " + str(date.today().year)
currentDate = str(1) + " " + "Feb" + " " + str(date.today().year)


Expand All @@ -21,11 +21,11 @@
# if there was an update scrape all the links
allLinks = []
http = httplib2.Http()
status, response = http.request('https://support.apple.com/en-us/HT201222')
status, response = http.request("https://support.apple.com/en-us/HT201222")

for link in BeautifulSoup(response, features="html.parser", parse_only=SoupStrainer('a')):
if link.has_attr('href'):
allLinks.append(link['href'])
for link in BeautifulSoup(response, features="html.parser", parse_only=SoupStrainer("a")):
if link.has_attr("href"):
allLinks.append(link["href"])

# get only the new links
searchResults = len(re.findall(currentDate, updatesPage)) + 22
Expand All @@ -37,10 +37,10 @@

for x in newLinks:
newLink = requests.get(x)
soup = BeautifulSoup(newLink.content, 'html.parser')
soup = BeautifulSoup(newLink.content, "html.parser")

# get the header of the new version
allHeaders = soup.find_all('h2')
allHeaders = soup.find_all("h2")
newHeader.append(re.sub("<[^>]*?>","", str(allHeaders[1])))

# search how many CVEs there are
Expand All @@ -50,10 +50,12 @@
# if there is macOS in the header take only the first part, not the full header
if "macOS" in x:
macosIsHere = newHeader.index(x)
newHeader[macosIsHere] = x.split(',', 1)[0]
newHeader[macosIsHere] = x.split(",", 1)[0]

# print results
print("PATCH TIME!")
results = "PATCH TIME!\n"
for x in newHeader:
print(x + " released with " + str(numberCVE[0]) + " security fixes")
numberCVE.pop(0)
results += x + " released with " + str(numberCVE[0]) + " security fixes\n"
numberCVE.pop(0)

print(results)

0 comments on commit 2bbcc95

Please sign in to comment.