Package ghidra.util.bytesearch
Interface BytePattern
- All Known Implementing Classes:
DittedBitSequence,GenericByteSequencePattern,Pattern
public interface BytePattern NEW
Interface for fixed length patterns that can be combined into a single state machine that can be
simultaneously searched for in a byte sequence.
-
Method Summary
ChangeModifier and TypeMethodDescriptionintReturns the number of bytes in this pattern that represent a pre-sequence that must match before the official start of the matching pattern.intgetSize()Returns the size of this pattern..booleanisMatch(int patternOffset, int byteValue) Checks if this pattern matches a byte value at a specific offset into the pattern.
-
Method Details
-
getSize
int getSize()Returns the size of this pattern..- Returns:
- the size of this pattern.
-
isMatch
boolean isMatch(int patternOffset, int byteValue) Checks if this pattern matches a byte value at a specific offset into the pattern.- Parameters:
patternOffset- the position in the pattern to check if it matches the given byte valuebyteValue- the byte value to check if it matches the pattern at the given offset. This value is passed as an int so that the byte can be treated as unsigned.- Returns:
- true if this pattern matches the given byte value at the given pattern offset.
-
getPreSequenceLength
int getPreSequenceLength()Returns the number of bytes in this pattern that represent a pre-sequence that must match before the official start of the matching pattern. For example if looking for a pattern of "abcd", but only if it follows "xyz", then the pattern would be "xyzabcd", with a pre sequence length of 3. So when this pattern matches, we want the "match to be at the position where the "a" is and not the "x". This is know as "look behind" when using regular expressions.- Returns:
- the number of bytes in the pattern that represent a required pre sequence before the actual pattern we want to find the position of
-