Package ghidra.util.bytesearch
Class MemoryBytePatternSearcher
- java.lang.Object
-
- ghidra.util.bytesearch.MemoryBytePatternSearcher
-
public class MemoryBytePatternSearcher extends java.lang.ObjectMulti 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
Constructors Constructor Description MemoryBytePatternSearcher(java.lang.String searchName)Create with no patternList, must add patterns before searchingMemoryBytePatternSearcher(java.lang.String searchName, SequenceSearchState root)Create with an initialized SequenceSearchStateMemoryBytePatternSearcher(java.lang.String searchName, java.util.ArrayList<Pattern> patternList)Create with pre-created patternList
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPattern(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 Detail
-
MemoryBytePatternSearcher
public MemoryBytePatternSearcher(java.lang.String searchName, java.util.ArrayList<Pattern> patternList)Create with pre-created patternList- Parameters:
searchName- name of searchpatternList- - list of patterns(bytes/mask/action)
-
MemoryBytePatternSearcher
public MemoryBytePatternSearcher(java.lang.String searchName, SequenceSearchState root)Create with an initialized SequenceSearchState- Parameters:
searchName- name of searchroot- search state pre-initialized
-
MemoryBytePatternSearcher
public MemoryBytePatternSearcher(java.lang.String searchName)
Create with no patternList, must add patterns before searching- Parameters:
searchName- name of search
-
-
Method Detail
-
addPattern
public void addPattern(Pattern pattern)
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
public void preMatchApply(MatchAction[] matchactions, Address addr)
Called before any match rules are applied- Parameters:
matchactions- actions that matchedaddr- address of match
-
postMatchApply
public void postMatchApply(MatchAction[] matchactions, Address addr)
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
-
-