mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-30 19:59:46 +02:00
Replace 'raise StopIteration' with a blank 'return', since changes in python-3.7 change StopIeration to a RuntimeError.
This commit is contained in:
@@ -118,7 +118,7 @@ class NlpDtbScanner(interfaces.layers.ScannerInterface):
|
||||
|
||||
entry_num = 0
|
||||
if len(validity_tests[self._layer_class]) < 1:
|
||||
raise StopIteration
|
||||
return
|
||||
validity_mask, validity_success = validity_tests[self._layer_class][0]
|
||||
for entry in entries:
|
||||
if (entry & validity_mask) == validity_success:
|
||||
|
||||
@@ -195,9 +195,10 @@ class KernelPDBScanner(interfaces.automagic.AutomagicInterface):
|
||||
_kvo, kernel = self.valid_kernels[virtual_layer]
|
||||
filter_string = os.path.join(kernel['pdb_name'], kernel['GUID'] + "-" + str(kernel['age']))
|
||||
# Take the first result of search for the intermediate file
|
||||
try:
|
||||
isf_path = intermed.IntermediateSymbolTable.file_symbol_url("windows", filter_string).__next__()
|
||||
except StopIteration:
|
||||
for value in intermed.IntermediateSymbolTable.file_symbol_url("windows", filter_string):
|
||||
isf_path = value
|
||||
break
|
||||
else:
|
||||
isf_path = ''
|
||||
if isf_path:
|
||||
vollog.debug("Using symbol library: {}".format(filter_string))
|
||||
|
||||
@@ -155,9 +155,9 @@ class Intel(interfaces.layers.TranslationLayerInterface):
|
||||
except exceptions.InvalidAddressException:
|
||||
if not ignore_errors:
|
||||
raise
|
||||
raise StopIteration
|
||||
return
|
||||
yield (offset, mapped_offset, length, layer_name)
|
||||
raise StopIteration
|
||||
return
|
||||
while length > 0:
|
||||
try:
|
||||
chunk_offset, page_size, layer_name = self._translate(offset)
|
||||
|
||||
@@ -88,9 +88,9 @@ class SegmentedLayer(interfaces.layers.TranslationLayerInterface, metaclass = AB
|
||||
current_offset = logical_offset
|
||||
# If it starts too late then we're done
|
||||
if logical_offset > offset + length:
|
||||
raise StopIteration
|
||||
return
|
||||
except exceptions.InvalidAddressException:
|
||||
raise StopIteration
|
||||
return
|
||||
# Crop it to the amount we need left
|
||||
chunk_size = min(size, length + offset - logical_offset)
|
||||
yield (logical_offset, mapped_offset, chunk_size, self._base_layer)
|
||||
|
||||
@@ -515,7 +515,7 @@ class _EPROCESS(generic.GenericIntelProcess, ExecutiveObject):
|
||||
|
||||
proc_layer = self._context.memory[proc_layer_name]
|
||||
if not proc_layer.is_valid(self.Peb):
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
sym_table = self.vol.type_name.split(constants.BANG)[0]
|
||||
peb = self._context.object("{}{}_PEB".format(sym_table, constants.BANG),
|
||||
|
||||
@@ -206,7 +206,7 @@ class Handles(interfaces_plugins.PluginInterface):
|
||||
count = 0x1000 / subtype.size
|
||||
|
||||
if not self.context.memory[virtual].is_valid(offset):
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
table = ntkrnlmp.object(type_name = "array", offset = offset,
|
||||
subtype = subtype, count = int(count))
|
||||
@@ -248,7 +248,7 @@ class Handles(interfaces_plugins.PluginInterface):
|
||||
table_levels = handle_table.TableCode & self._level_mask
|
||||
except exceptions.PagedInvalidAddressException:
|
||||
vollog.log(constants.LOGLEVEL_VVV, "Handle table parsing was aborted due to an invalid address exception")
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
for handle_table_entry in self._make_handle_array(TableCode, table_levels):
|
||||
yield handle_table_entry
|
||||
|
||||
@@ -45,7 +45,7 @@ class PrintKey(plugins.PluginInterface):
|
||||
node_path = [hive.get_node(hive.root_cell_offset)]
|
||||
if not isinstance(node_path, list) or len(node_path) < 1:
|
||||
vollog.warning("Hive walker was not passed a valid node_path (or None)")
|
||||
raise StopIteration
|
||||
return
|
||||
node = node_path[-1]
|
||||
key_path = key_path or node.get_key_path()
|
||||
last_write_time = utility.wintime_to_datetime(node.LastWriteTime.QuadPart)
|
||||
|
||||
@@ -132,7 +132,7 @@ class UserAssist(interfaces_plugins.PluginInterface):
|
||||
|
||||
if not userassist_node_path:
|
||||
vollog.warning("list_userassist did not find a valid node_path (or None)")
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
userassist_node = userassist_node_path[-1]
|
||||
# iterate through the GUIDs under the userassist key
|
||||
|
||||
@@ -45,7 +45,7 @@ class Strings(interfaces.plugins.PluginInterface):
|
||||
yield (0, (str(string, 'latin-1'), format_hints.Hex(offset), ", ".join(revmap_list)))
|
||||
except ValueError:
|
||||
vollog.error("Strings file is in the wrong format")
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
def _parse_line(self, line: bytes) -> typing.Tuple[int, bytes]:
|
||||
"""Parses a single line from a strings file"""
|
||||
|
||||
Reference in New Issue
Block a user