Skip to content

Commit 333e022

Browse files
committed
fix ident errors
1 parent dbfb0d8 commit 333e022

File tree

2 files changed

+789
-530
lines changed

2 files changed

+789
-530
lines changed

markdown/2024_insights/03_analysis.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -270,41 +270,53 @@ critical_spikes = {"2023": {}, "2024": {}}
270270
critical_vulns_2023 = df_2023[df_2023['CVSS_Severity'] == 'CRITICAL']
271271
critical_vulns_2024 = df_2024[df_2024['CVSS_Severity'] == 'CRITICAL']
272272

273+
# For 2024
273274
for vendor in top_vendors_2024['Vendor']:
274275
critical_spikes["2024"][vendor] = {}
275-
vendor_critical = critical_vulns_2024[critical_vulns_2024['Vendor'] == vendor]
276-
for product in top_products["2024"].get(vendor, []):
277-
product_name = product['Product']
278-
product_critical = vendor_critical[vendor_critical['Product'] == product_name]
279-
if not product_critical.empty:
280-
top_month = (
281-
product_critical.groupby('Published_Month').size().idxmax()
282-
)
283-
count = (
284-
product_critical.groupby('Published_Month').size().max()
285-
)
286-
critical_spikes["2024"][vendor][product_name] = {
287-
"month": pd.to_datetime(f"2024-{top_month}-01").strftime('%B'),
288-
"count": int(count)
289-
}
276+
vendor_critical = critical_vulns_2024[critical_vulns_2024['Vendor'] == vendor]
277+
for product in top_products["2024"].get(vendor, []):
278+
product_name = product['Product']
279+
product_critical = vendor_critical[vendor_critical['Product'] == product_name]
280+
if not product_critical.empty:
281+
top_month = (
282+
product_critical.groupby('Published_Month').size().idxmax()
283+
)
284+
count = (
285+
product_critical.groupby('Published_Month').size().max()
286+
)
287+
critical_spikes["2024"][vendor][product_name] = {
288+
"month": pd.to_datetime(f"2024-{top_month}-01").strftime('%B'),
289+
"count": int(count)
290+
}
291+
else:
292+
critical_spikes["2024"][vendor][product_name] = {
293+
"month": None,
294+
"count": 0
295+
}
290296

297+
# For 2023
291298
for vendor in top_vendors_2023['Vendor']:
292299
critical_spikes["2023"][vendor] = {}
293-
vendor_critical = critical_vulns_2023[critical_vulns_2023['Vendor'] == vendor]
294-
for product in top_products["2023"].get(vendor, []):
295-
product_name = product['Product']
296-
product_critical = vendor_critical[vendor_critical['Product'] == product_name]
297-
if not product_critical.empty:
298-
top_month = (
299-
product_critical.groupby('Published_Month').size().idxmax()
300-
)
301-
count = (
302-
product_critical.groupby('Published_Month').size().max()
303-
)
304-
critical_spikes["2023"][vendor][product_name] = {
305-
"month": pd.to_datetime(f"2023-{top_month}-01").strftime('%B'),
306-
"count": int(count)
307-
}
300+
vendor_critical = critical_vulns_2023[critical_vulns_2023['Vendor'] == vendor]
301+
for product in top_products["2023"].get(vendor, []):
302+
product_name = product['Product']
303+
product_critical = vendor_critical[vendor_critical['Product'] == product_name]
304+
if not product_critical.empty:
305+
top_month = (
306+
product_critical.groupby('Published_Month').size().idxmax()
307+
)
308+
count = (
309+
product_critical.groupby('Published_Month').size().max()
310+
)
311+
critical_spikes["2023"][vendor][product_name] = {
312+
"month": pd.to_datetime(f"2023-{top_month}-01").strftime('%B'),
313+
"count": int(count)
314+
}
315+
else:
316+
critical_spikes["2023"][vendor][product_name] = {
317+
"month": None,
318+
"count": 0
319+
}
308320

309321
# Final Vendor/Product Analysis JSON
310322
vendor_product = {
@@ -487,9 +499,9 @@ if remaining_cves_needed > 0:
487499
.drop_duplicates()
488500
.head(remaining_cves_needed)
489501
)
490-
most_severe = pd.concat([cvss_10_cves, additional_cves]).drop_duplicates()
502+
most_severe = pd.concat([cvss_10_cves, additional_cves]).drop_duplicates()
491503
else:
492-
most_severe = cvss_10_cves
504+
most_severe = cvss_10_cves
493505

494506
# Ensure the final result is sorted and unique
495507
most_severe = (

0 commit comments

Comments
 (0)