Class BinaryPatternVerifier
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.analyzer.BinaryPatternVerifier
A collection of binary patterns and a verifier for them. Determine if any one of the pattern
matches a provided bytes buffer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPattern(IBinaryPattern pattern) Add a binary pattern to this verifier.voidaddPatterns(IBinaryPattern... patterns) Add binary patterns to this verifier.voidaddPatterns(Collection<IBinaryPattern> patterns) Add binary patterns to this verifier.voidclear()Remove all registered patterns.intGet the longest registered pattern size.Get the registered patterns.verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd) Verify a buffer against registered patterns.verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd, int patternSize) Verify a buffer against registered patterns of a given size.verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd, int patternSize, int processorMode) Verify a buffer against registered patterns.
-
Constructor Details
-
BinaryPatternVerifier
public BinaryPatternVerifier()Create an empty binary pattern verifier.
-
-
Method Details
-
addPatterns
Add binary patterns to this verifier.- Parameters:
patterns- patterns to add
-
addPatterns
Add binary patterns to this verifier.- Parameters:
patterns- patterns to add
-
addPattern
Add a binary pattern to this verifier.- Parameters:
pattern- pattern to add
-
getPatterns
Get the registered patterns.- Returns:
- unmodifiable pattern collection
-
clear
public void clear()Remove all registered patterns. -
getLongestSize
public int getLongestSize()Get the longest registered pattern size.- Returns:
- longest pattern size in bytes
-
verify
public IBinaryPattern verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd) Verify a buffer against registered patterns.- Parameters:
gca- native code analyzeraddress- address associated with the start of the bufferbuffer- bytes to verifyoffset- start offset in the bufferoffsetEnd- end offset in the buffer- Returns:
- matching pattern, or null if none matched
-
verify
public IBinaryPattern verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd, int patternSize) Verify a buffer against registered patterns of a given size.- Parameters:
gca- native code analyzeraddress- address associated with the start of the bufferbuffer- bytes to verifyoffset- start offset in the bufferoffsetEnd- end offset in the bufferpatternSize- if different from zero, only patterns of this byte size are tested- Returns:
- matching pattern, or null if none matched
-
verify
public IBinaryPattern verify(INativeCodeAnalyzer<?> gca, long address, byte[] buffer, int offset, int offsetEnd, int patternSize, int processorMode) Verify a buffer against registered patterns.- Parameters:
gca- native code analyzeraddress- address associated with the start of the bufferbuffer- bytes to verifyoffset- start offset in the bufferoffsetEnd- end offset in the bufferpatternSize- if different from zero, the verification is only done with the patterns of the given size in bytesprocessorMode- restricted processor mode, matchingIBinaryPattern.getProcessorMode(). UseIProcessor.MODE_DEFAULTto test all modes or pick one to restrict verification.- Returns:
- matching pattern, or null if none matched
-