Replace 'raise StopIteration' with a blank 'return', since changes in python-3.7 change StopIeration to a RuntimeError.

This commit is contained in:
Mike Auty
2018-09-28 12:44:19 +01:00
parent 3e176c8a50
commit de3bfad135
9 changed files with 15 additions and 14 deletions
@@ -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:
+4 -3
View File
@@ -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))
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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),