Class ByteMatcher

java.lang.Object
ghidra.features.base.memsearch.matcher.ByteMatcher
Direct Known Subclasses:
InvalidByteMatcher, MaskedByteSequenceByteMatcher, RegExByteMatcher

public abstract class ByteMatcher extends Object
ByteMatcher is the base class for an object that be used to scan bytes looking for sequences that match some criteria. As a convenience, it also stores the input string and settings that were used to generated this ByteMatcher.
  • Constructor Details

  • Method Details

    • getInput

      public final String getInput()
      Returns the original input text that generated this ByteMatacher.
      Returns:
      the original input text that generated this BytesMatcher
    • getSettings

      public SearchSettings getSettings()
      Returns the settings used to generate this ByteMatcher.
      Returns:
      the settings used to generate this ByteMatcher
    • match

      public abstract Iterable<ByteMatcher.ByteMatch> match(ExtendedByteSequence bytes)
      Returns an Iterable for returning matches within the given byte sequence.
      Parameters:
      bytes - the byte sequence to search
      Returns:
      an iterable for return matches in the given sequence
    • getDescription

      public abstract String getDescription()
      Returns a description of what this byte matcher matches. (Typically a sequence of bytes)
      Returns:
      a description of what this byte matcher matches
    • getToolTip

      public abstract String getToolTip()
      Returns additional information about this byte matcher. (Typically the mask bytes)
      Returns:
      additional information about this byte matcher
    • isValidSearch

      public boolean isValidSearch()
      Returns true if this byte matcher is valid and can be used to perform a search. If false, the the description will return a an error message explaining why this byte matcher is invalid.
      Returns:
      true if this byte matcher is valid and can be used to perform a search.
    • isValidInput

      public boolean isValidInput()
      Returns true if this byte matcher has valid (but possibly incomplete) input text. For example, when entering decimal values, the input could be just "-" as the user starts to enter a negative number. In this case the input is valid, but the isValidSearch() would return false.
      Returns:
      true if this byte matcher has valid text
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object