Package ghidra.util.bytesearch
Class MemoryBytePatternSearcher
java.lang.Object
ghidra.util.bytesearch.MemoryBytePatternSearcher
Multi pattern/mask/action memory searcher
Patterns must be supplied/added, or a pre-initialized searchState supplied
Preload search patterns and actions, then call search method.
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryBytePatternSearcher(String searchName) Create with no patternList, must add patterns before searchingMemoryBytePatternSearcher(String searchName, SequenceSearchState root) Create with an initialized SequenceSearchStateMemoryBytePatternSearcher(String searchName, ArrayList<Pattern> patternList) Create with pre-created patternList -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPattern(Pattern pattern) Add a search patternvoidpostMatchApply(MatchAction[] matchactions, Address addr) Called after any match rules are applied Can use for cross post rule matching state application and cleanup.voidpreMatchApply(MatchAction[] matchactions, Address addr) Called before any match rules are appliedvoidsearch(Program program, AddressSetView searchSet, TaskMonitor monitor) Search initialized memory blocks for all patterns(bytes/mask/action).voidsetSearchExecutableOnly(boolean doExecutableBlocksOnly)
-
Constructor Details
-
MemoryBytePatternSearcher
Create with pre-created patternList- Parameters:
searchName- name of searchpatternList- - list of patterns(bytes/mask/action)
-
MemoryBytePatternSearcher
Create with an initialized SequenceSearchState- Parameters:
searchName- name of searchroot- search state pre-initialized
-
MemoryBytePatternSearcher
Create with no patternList, must add patterns before searching- Parameters:
searchName- name of search
-
-
Method Details
-
addPattern
Add a search pattern- Parameters:
pattern- - pattern(bytes/mask/action)
-
setSearchExecutableOnly
public void setSearchExecutableOnly(boolean doExecutableBlocksOnly) -
search
public void search(Program program, AddressSetView searchSet, TaskMonitor monitor) throws CancelledException Search initialized memory blocks for all patterns(bytes/mask/action). Call associated action for each pattern matched.- Parameters:
program- to be searchedsearchSet- set of bytes to restrict search, if null or empty then search all memory blocksmonitor- allow canceling and reporting of progress- Throws:
CancelledException- if canceled
-
preMatchApply
Called before any match rules are applied- Parameters:
matchactions- actions that matchedaddr- address of match
-
postMatchApply
Called after any match rules are applied Can use for cross post rule matching state application and cleanup.- Parameters:
matchactions- actions that matchedaddr- adress of match
-