diff --git a/PyMemoryEditor/util/scan.py b/PyMemoryEditor/util/scan.py index a62135a..0819071 100644 --- a/PyMemoryEditor/util/scan.py +++ b/PyMemoryEditor/util/scan.py @@ -21,20 +21,21 @@ def scan_memory_for_exact_value( This method uses an efficient searching algorithm. """ - searcher = KMPSearch(target_value, target_value_size) + data = bytes(memory_region_data) last_index = 0 + found_index = data.find(target_value, 0) - for found_index in searcher.search(memory_region_data, memory_region_data_size): - + while found_index != -1: # Return the found index if user is searching for an exact value. if comparison is ScanTypesEnum.EXACT_VALUE: yield found_index - continue # Return the interval between last_index and found_address, if user is searching for a different value. - for different_index in range(last_index, found_index): - yield different_index - last_index = found_index + 1 + elif comparison is ScanTypesEnum.NOT_EXACT_VALUE: + for different_index in range(last_index, found_index): + yield different_index + last_index = found_index + 1 + found_index = data.find(target_value, found_index+1) # If user is searching for a different value, return the rest of the addresses that were not found. if comparison is ScanTypesEnum.NOT_EXACT_VALUE: