Skip to content

Commit

Permalink
Version 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amadejpapez authored Feb 8, 2021
1 parent 9275f7b commit 8336b88
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions ApplSec.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ def getData(link):
text = str(numberCVE) + " bugs fixed"
CVEs.append(text)

# get data about which parts got bug fixes
if "iOS" in currentHeader:
# get data about which parts got bug fixes in the latest iOS update
if "iOS 14" in currentHeader:
allStrong = soup.find_all("strong")
allStrong = re.sub("<[^>]*?>","", str(allStrong))
allStrong = allStrong.strip('][').split(', ')
global countStrong
countStrong = Counter(allStrong)
global partHeader
partHeader = currentHeader
global partLink
partLink = x

# get data if any entries were added
if link == entriesAdded:
Expand Down Expand Up @@ -116,21 +118,22 @@ def getData(link):
results2 = ":mega: EMERGENCY UPDATES :mega:\n\n"
results = results2 + results3

api.update_status(emoji.emojize("{}".format(results), use_aliases=True))
print(emoji.emojize("{}".format(results), use_aliases=True))


# get all the links from the page
allLinks = []
updatesPage = requests.get("https://support.apple.com/en-us/HT201222").text
for link in BeautifulSoup(updatesPage, features="html.parser", parse_only=SoupStrainer("a")):
mainLink = "https://support.apple.com/en-us/HT201222"
mainPage = requests.get(mainLink).text
for link in BeautifulSoup(mainPage, features="html.parser", parse_only=SoupStrainer("a")):
if link.has_attr("href"):
allLinks.append(link["href"])

# check and tweet results if there are were new updates released
currentDateFormatOne = str(date.today().day) + " " + str(date.today().strftime("%B")[0:3]) + " " + str(date.today().year)
if currentDateFormatOne in updatesPage:
if currentDateFormatOne in mainPage:
# get only the new links from the page
newLinks = allLinks[22:len(re.findall(currentDateFormatOne, updatesPage)) + 22]
newLinks = allLinks[22:len(re.findall(currentDateFormatOne, mainPage)) + 22]
getData(newLinks)

if len(headers) == 1:
Expand All @@ -143,7 +146,8 @@ def getData(link):
CVEs.pop(0)
emojis.pop(0)

api.update_status(emoji.emojize("{}".format(results), use_aliases=True))
results += mainLink + "\n"
print(emoji.emojize("{}".format(results), use_aliases=True))


# tweet top 5 parts that got bug fixes in a new iOS update
Expand All @@ -161,8 +165,8 @@ def getData(link):
results += "- " + str(value) + " bugs in " + str(key) + "\n"

numberParts = iosCVE - numberParts
results += "and " + str(numberParts) + " more bugs fixed!\n"
api.update_status(emoji.emojize("{}".format(results), use_aliases=True))
results += "and " + str(numberParts) + " other vulnerabilities patched!\n" + partLink + "\n"
print(emoji.emojize("{}".format(results), use_aliases=True))


# check if there are any changes to the last 20 release pages and tweet the results
Expand Down Expand Up @@ -204,4 +208,4 @@ def getData(link):
results2 = ":arrows_counterclockwise: " + str(len(re.findall("-", results3))) + " SECURITY NOTES UPDATED :arrows_counterclockwise:\n\n"

results = results2 + results3
api.update_status(emoji.emojize("{}".format(results), use_aliases=True))
print(emoji.emojize("{}".format(results), use_aliases=True))

0 comments on commit 8336b88

Please sign in to comment.