diff --git a/volatility3/framework/plugins/windows/consoles.py b/volatility3/framework/plugins/windows/consoles.py index a2eade321..dfc14f2d6 100644 --- a/volatility3/framework/plugins/windows/consoles.py +++ b/volatility3/framework/plugins/windows/consoles.py @@ -168,7 +168,7 @@ class Consoles(interfaces.plugins.PluginInterface): raise NotImplementedError( "Kernel Debug Structure version format not supported!" ) - except: + except Exception: # unsure what to raise here. Also, it might be useful to add some kind of fallback, # either to a user-provided version or to another method to determine conhost.exe's version raise exceptions.VolatilityException( @@ -834,7 +834,7 @@ class Consoles(interfaces.plugins.PluginInterface): max_history.add(value.decode_data()) elif val_name == "NumberOfHistoryBuffers": max_buffers.add(value.decode_data()) - except: + except Exception: continue return max_history, max_buffers diff --git a/volatility3/framework/symbols/windows/extensions/consoles.py b/volatility3/framework/symbols/windows/extensions/consoles.py index 555197fc4..390b6858d 100644 --- a/volatility3/framework/symbols/windows/extensions/consoles.py +++ b/volatility3/framework/symbols/windows/extensions/consoles.py @@ -95,6 +95,8 @@ class ALIAS(objects.StructType): "string", encoding="utf-16", errors="replace", max_length=512 ) + return None + def get_target(self): if self.Target.Length < 8: return self.Target.Chars.cast( @@ -108,6 +110,8 @@ class ALIAS(objects.StructType): "string", encoding="utf-16", errors="replace", max_length=512 ) + return None + class EXE_ALIAS_LIST(objects.StructType): """An Exe Alias List Structure""" @@ -131,6 +135,8 @@ class EXE_ALIAS_LIST(objects.StructType): "string", encoding="utf-16", errors="replace", max_length=512 ) + return None + def get_aliases(self): """Generator for the individual aliases for a particular executable.""" @@ -211,7 +217,7 @@ class SCREEN_INFORMATION(objects.StructType): try: text = row.get_text(truncate_lines) rows.append(text) - except: + except Exception: break if truncate_rows: @@ -301,7 +307,7 @@ class CONSOLE_INFORMATION(objects.StructType): return self.Title.dereference().cast( "string", encoding="utf-16", errors="replace", max_length=512 ) - except: + except Exception: return "" def get_original_title(self): @@ -309,7 +315,7 @@ class CONSOLE_INFORMATION(objects.StructType): return self.OriginalTitle.dereference().cast( "string", encoding="utf-16", errors="replace", max_length=512 ) - except: + except Exception: return "" @@ -340,6 +346,8 @@ class COMMAND(objects.StructType): "string", encoding="utf-16", errors="replace", max_length=512 ) + return None + class COMMAND_HISTORY(objects.StructType): """A Command History Structure.""" @@ -387,6 +395,8 @@ class COMMAND_HISTORY(objects.StructType): "string", encoding="utf-16", errors="replace", max_length=512 ) + return None + def scan_command_bucket(self, end=None): """Brute force print all strings pointed to by the CommandBucket entries by going to greater of EndCapacity or CommandCountMax*sizeof(_COMMAND)"""