File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -21,20 +21,21 @@ def scan_memory_for_exact_value(
2121
2222 This method uses an efficient searching algorithm.
2323 """
24- searcher = KMPSearch ( target_value , target_value_size )
24+ data = bytes ( memory_region_data )
2525 last_index = 0
26+ found_index = data .find (target_value , 0 )
2627
27- for found_index in searcher .search (memory_region_data , memory_region_data_size ):
28-
28+ while found_index != - 1 :
2929 # Return the found index if user is searching for an exact value.
3030 if comparison is ScanTypesEnum .EXACT_VALUE :
3131 yield found_index
32- continue
3332
3433 # Return the interval between last_index and found_address, if user is searching for a different value.
35- for different_index in range (last_index , found_index ):
36- yield different_index
37- last_index = found_index + 1
34+ elif comparison is ScanTypesEnum .NOT_EXACT_VALUE :
35+ for different_index in range (last_index , found_index ):
36+ yield different_index
37+ last_index = found_index + 1
38+ found_index = data .find (target_value , found_index + 1 )
3839
3940 # If user is searching for a different value, return the rest of the addresses that were not found.
4041 if comparison is ScanTypesEnum .NOT_EXACT_VALUE :
You can’t perform that action at this time.
0 commit comments