java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.analyzer.BinaryPattern
All Implemented Interfaces:
IBinaryPattern

@Ser public class BinaryPattern extends Object implements IBinaryPattern
Basic implementation of a binary pattern. The checks are bytes+mask only; The custom verification method simply returns true.
  • Constructor Details

    • BinaryPattern

      public BinaryPattern(byte[] binary)
      Create a binary pattern without a mask.
      Parameters:
      binary - pattern bytes
    • BinaryPattern

      public BinaryPattern(byte[] binary, byte[] mask)
      Create a binary pattern.
      Parameters:
      binary - pattern bytes
      mask - optional byte mask
    • BinaryPattern

      public BinaryPattern(byte[] binary, byte[] mask, int realStartOffset)
      Create a binary pattern.
      Parameters:
      binary - pattern bytes
      mask - optional byte mask
      realStartOffset - offset of the first pattern byte from the verified buffer start
    • BinaryPattern

      public BinaryPattern(byte[] binary, byte[] mask, int realStartOffset, int processorMode)
      Create a binary pattern.
      Parameters:
      binary - pattern bytes
      mask - optional byte mask
      realStartOffset - offset of the first pattern byte from the verified buffer start
      processorMode - processor mode restriction
  • Method Details

    • getBinary

      public byte[] getBinary()
      Description copied from interface: IBinaryPattern
      Binary bytes. Mandatory.
      Specified by:
      getBinary in interface IBinaryPattern
      Returns:
      binary bytes
    • getMask

      public byte[] getMask()
      Description copied from interface: IBinaryPattern
      Binary mask. Optional. If present, must have same length as IBinaryPattern.getBinary().
      Specified by:
      getMask in interface IBinaryPattern
      Returns:
      binary mask, or null
    • getRealStartOffset

      public int getRealStartOffset()
      Description copied from interface: IBinaryPattern
      The real start offset.
      Specified by:
      getRealStartOffset in interface IBinaryPattern
      Returns:
      real start offset
    • getProcessorMode

      public int getProcessorMode()
      Description copied from interface: IBinaryPattern
      Valid processor mode for this Binary Pattern. Can be IProcessor.MODE_DEFAULT if valid in any mode.
      Specified by:
      getProcessorMode in interface IBinaryPattern
      Returns:
      processor mode
    • validate

      public boolean validate(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd)
      Description copied from interface: IBinaryPattern
      Final validation. Optional method.
      Specified by:
      validate in interface IBinaryPattern
      Parameters:
      gca - native code analyzer
      address - address being checked
      buffer - data buffer
      offset - start offset in the buffer
      offsetEnd - end offset in the buffer
      Returns:
      true if the candidate match is valid
    • getExtra

      public Object getExtra()
      Description copied from interface: IBinaryPattern
      Get some extra data associated to this pattern. Client specific.
      Specified by:
      getExtra in interface IBinaryPattern
      Returns:
      optional data
    • toString

      public String toString()
      Overrides:
      toString in class Object