Skip to content

Commit

Permalink
Fixing a bug in Windows 10, the dataframe filter functions were only …
Browse files Browse the repository at this point in the history
…designed to work on windows 11 so I added the Windows 10 filters also
  • Loading branch information
Dale Brennan committed Feb 5, 2024
1 parent 105eed6 commit 4bca42f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pages/EM_11_vulnerability_patching_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

def generate_patching_graphs(df):
try:
filtered_df = df[df['Software'].str.contains('Update for Windows 11', na=False)]
filtered_df = df[df['Software'].str.contains('Update for Windows 11|Update for Windows 10', na=False)]

# We first need to convert the Microsoft DateTime stamp format: 20231215060522.240996-000 into a format we can perform calculations with in pandas
# To do this we are stripping the 4 end characters and then using pandas datetime to make the conversion
Expand Down Expand Up @@ -77,7 +77,7 @@ def calculate_duration(group):
def generate_updates_graph(df):
try:
def _categorize_software(software):
if 'Update for Windows 11' in software:
if 'Update for Windows 11' in software or 'Update for Windows 10' in software:
return 'Windows System Update'
elif 'Security Intelligence Update for Microsoft Defender Antivirus' in software:
return 'Microsoft Defender Update'
Expand All @@ -91,7 +91,7 @@ def _categorize_software(software):
df['SoftwareType'] = df['Software'].apply(_categorize_software)

installed_updates = df[
((df['Software'].str.contains('Update for Windows 11', na=False)) & (df['EventIdentifier'] == 'Installed')) |
((df['Software'].str.contains('Update for Windows 11|Update for Windows 10', na=False)) & (df['EventIdentifier'] == 'Installed')) |
((df['Software'].str.contains('Security Intelligence Update for Microsoft Defender Antivirus', na=False)) & (df['EventIdentifier'] == 'Installed')) |
((df['Software'].str.contains('Update for Windows Security platform antimalware platform', na=False)) & (df['EventIdentifier'] == 'Installed')) |
((df['Software'].str.contains('Cumulative Update for .NET Framework', na=False)) & (df['EventIdentifier'] == 'Installed'))
Expand Down
2 changes: 1 addition & 1 deletion pages/EM_12_reboot_analysis_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def patch_to_reboot_analysis(df, df_v):
earliest_versions = df.groupby('SoftwareVersion')['StartTime'].min().reset_index()

# Clean the vulnerability dataframe and set the timestamp in a format pd can use
installed_updates = df_v[(df_v['Software'].str.contains('Cumulative Update for Windows 11', na=False)) & (df_v['EventIdentifier'] == 'Install Started')]
installed_updates = df_v[(df_v['Software'].str.contains('Cumulative Update for Windows 11|Cumulative Update for Windows 10', na=False)) & (df_v['EventIdentifier'] == 'Install Started')]
installed_updates.loc[:, 'TimeGenerated'] = installed_updates['TimeGenerated'].str[:-4]
installed_updates.loc[:, 'TimeGenerated'] = pd.to_datetime(installed_updates['TimeGenerated'], format='%Y%m%d%H%M%S.%f')
installed_updates = installed_updates.drop(columns=['UpdateGUID', 'EventIdentifier'])
Expand Down

0 comments on commit 4bca42f

Please sign in to comment.