From 73aa73f30efb16d9a3502d088691763a7f2b94a7 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 3 Nov 2019 22:46:20 +0000 Subject: [PATCH] Ensure we test None using is rather than ==. --- volatility/framework/plugins/mac/bash.py | 2 +- volatility/framework/plugins/windows/handles.py | 8 ++++---- .../framework/symbols/windows/extensions/__init__.py | 4 ++-- .../framework/symbols/windows/extensions/registry.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/volatility/framework/plugins/mac/bash.py b/volatility/framework/plugins/mac/bash.py index 3ec84339b..2873fe04e 100644 --- a/volatility/framework/plugins/mac/bash.py +++ b/volatility/framework/plugins/mac/bash.py @@ -51,7 +51,7 @@ class Bash(plugins.PluginInterface, timeliner.TimeLinerInterface): continue proc_layer_name = task.add_process_layer() - if proc_layer_name == None: + if proc_layer_name is None: continue proc_layer = self.context.layers[proc_layer_name] diff --git a/volatility/framework/plugins/windows/handles.py b/volatility/framework/plugins/windows/handles.py index 726966170..d744e604e 100644 --- a/volatility/framework/plugins/windows/handles.py +++ b/volatility/framework/plugins/windows/handles.py @@ -84,7 +84,7 @@ class Handles(interfaces.plugins.PluginInterface): magic = self.find_sar_value() # is this the right thing to raise here? - if magic == None: + if magic is None: raise AttributeError( "Unable to find the SAR value for decoding handle table pointers (Is capstone installed?)") @@ -121,7 +121,7 @@ class Handles(interfaces.plugins.PluginInterface): return None data = self.context.layers.read(virtual_layer_name, kvo + func_addr, 0x200) - if data == None: + if data is None: return None md = capstone.Cs(capstone.CS_ARCH_X86, capstone.CS_MODE_64) @@ -252,7 +252,7 @@ class Handles(interfaces.plugins.PluginInterface): item = self._get_item(entry, handle_value) - if item == None: + if item is None: continue try: @@ -300,7 +300,7 @@ class Handles(interfaces.plugins.PluginInterface): try: self.context.layers[self.config["primary"]].is_valid(entry.vol.offset) obj_type = entry.get_object_type(type_map, cookie) - if obj_type == None: + if obj_type is None: continue if obj_type == "File": item = entry.Body.cast("_FILE_OBJECT") diff --git a/volatility/framework/symbols/windows/extensions/__init__.py b/volatility/framework/symbols/windows/extensions/__init__.py index b13e9eee7..c937d8d09 100644 --- a/volatility/framework/symbols/windows/extensions/__init__.py +++ b/volatility/framework/symbols/windows/extensions/__init__.py @@ -240,7 +240,7 @@ class MMVAD_SHORT(objects.StructType): vollog.log(constants.LOGLEVEL_VVV, "Vad tree is too deep, something went wrong!") raise RuntimeError("Vad tree is too deep") - if visited == None: + if visited is None: visited = set() vad_address = self.vol.offset @@ -624,7 +624,7 @@ class OBJECT_HEADER(objects.StructType): layer = self._context.layers[self.vol.native_layer_name] kvo = layer.config.get("kernel_virtual_offset", None) - if kvo == None: + if kvo is None: raise AttributeError("Could not find kernel_virtual_offset for layer: {}".format(self.vol.layer_name)) ntkrnlmp = self._context.module(symbol_table_name, layer_name = self.vol.layer_name, offset = kvo) diff --git a/volatility/framework/symbols/windows/extensions/registry.py b/volatility/framework/symbols/windows/extensions/registry.py index 44ca9e124..132e7ba66 100644 --- a/volatility/framework/symbols/windows/extensions/registry.py +++ b/volatility/framework/symbols/windows/extensions/registry.py @@ -110,7 +110,7 @@ class CM_KEY_BODY(objects.StructType): output = [] kcb = self.KeyControlBlock while kcb.ParentKcb: - if kcb.NameBlock.Name == None: + if kcb.NameBlock.Name is None: break if self._skip_key_hive_entry_path(kcb.Flags):