Class BpsXmlParser

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

public class BpsXmlParser extends Object
This is the main class which parses pattern search XML files as used by the Byte Pattern Search capability within Ghidra.

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 parses the provided byte pattern search XML files, populating corresponding Byte Pattern Searcher objects: BpsSearch,BpsSearchItem, and BpsPattern for processing and searching downstream.

A search pattern XML file contains a set of byte patterns, organized into a simple hierarchy, which contain specific meta-data details that will shape the search criteria. A full discussion on the required XML schema can be found in the "Search For Byte Patterns" page in the help viewer.

Note: All XML search documents must adhere to the structure outlined in the Byte Pattern Search help file. Parse errors due to malformed XML or an XML structure that does not follow the form, will result in accumulated parse errors which will be displayed once parsing has completed.

  • Constructor Details

    • BpsXmlParser

      public BpsXmlParser()
  • Method Details

    • parseSearchFile

      public static List<BpsSearch> parseSearchFile(File searchFile, TaskMonitor monitor) throws SAXException
      Parse the provided XML file, generating a list of BpsSearch objects. A map is used to support the skipping of patterns at the <Search> and <SearchItem> levels.

      All pattern files must have surrounding <BytePatternSearchLibrary> tags and adhere to the structure outlined in the Byte pattern Search help file.

      Parameters:
      searchFile - XML file to be parsed
      monitor - the task monitor
      Returns:
      Byte pattern searches
      Throws:
      SAXException - for malformed XML parse errors