Class BpsSearchItem

java.lang.Object
ghidra.util.bytesearch.bytepatternsearch.BpsSearchItem

public class BpsSearchItem extends Object
This class represents a parsed search item as used by the Byte Pattern Searcher capability within Ghidra.

The design of the XML Parser and its supporting classes can be found in BpsXmlParser.

The design of the Byte Pattern Searcher and its supporting sub-capabilities and classes can be found in the "Search For Byte Patterns" page in the help viewer.

This class manages the search item characteristics parsed from the <SearchItem> XML tag.

Byte Pattern Search Item Configurations

Required Variables:

  • patternName – Name of the pattern for referencing.
  • wordSize – The pattern word size, resolved from the WordSize attribute from the <SearchItem> tag.
  • searchType – The BpsSearchType strategy (table, constant, function, or ordered function search, see BpsSearchType) which dictates how patterns are searched.
  • patterns – The <BpsPattern> collection of search byte sequences.

Optional Variables:

  • description – Text explanation detailing the purpose of the search pattern.
  • submitter – The contributor who added this pattern to the BpsSearch.
Note: additional attributes may be included on the <Search> tag, they will be stored in a map for filtering and sorting downstream.
  • Constructor Details

    • BpsSearchItem

      public BpsSearchItem(String patternName, String key, int wordSize, BpsSearchType searchType)
      Constructor.
      Parameters:
      patternName - name of pattern
      key - unique key to facilitate skipping patterns at the <SearchItem> level
      wordSize - word size for pattern bytes (e.g. byte-8, word-16, dword-32, qword-64)
      searchType - how the bytes should be searched
  • Method Details

    • getPatternName

      public String getPatternName()
      Returns the pattern name.
      Returns:
      the pattern name
    • getId

      public String getId()
      Returns the search item's ID.
      Returns:
      the search item's ID
    • getWordSize

      public int getWordSize()
      Returns the pattern's word size.
      Returns:
      the pattern's word size
    • getSearchType

      public BpsSearchType getSearchType()
      Returns the pattern's search type.
      Returns:
      the pattern's search type
    • getPatterns

      public List<BpsPattern> getPatterns()
      Returns the pattern's byte collection.
      Returns:
      the pattern's byte collection
    • getDescription

      public String getDescription()
      Returns the search item's description.
      Returns:
      the search item's description
    • getSubmitter

      public String getSubmitter()
      Returns the submitter of the pattern.
      Returns:
      the submitter of the pattern
    • getAdditionalAttributes

      public Map<String,String> getAdditionalAttributes()
      Returns the additional attributes map parsed from the <SearchItem> tag.
      Returns:
      the additional attributes map parsed from the <SearchItem> tag