Binary Ninja API C++: BinaryNinja::StringRecognizer Class Reference
StringRecognizer recognizes custom strings found in high level expressions.
More...
StringRecognizer recognizes custom strings found in high level expressions.
Public Member Functions | |
| StringRecognizer (const std::string &name) | |
| StringRecognizer (BNStringRecognizer *renderer) | |
| std::string | GetName () const |
| virtual bool | IsValidForType (HighLevelILFunction *func, Type *type) |
| Determines if the string recognizer should be called for the given expression type. | |
| virtual std::optional< DerivedString > | RecognizeConstant (const HighLevelILInstruction &instr, Type *type, int64_t val) |
| Can be overridden to recognize strings for a constant that is not a pointer. | |
| virtual std::optional< DerivedString > | RecognizeConstantPointer (const HighLevelILInstruction &instr, Type *type, int64_t val) |
| Can be overridden to recognize strings for a constant pointer. | |
| virtual std::optional< DerivedString > | RecognizeExternPointer (const HighLevelILInstruction &instr, Type *type, int64_t val, uint64_t offset) |
| Can be overridden to recognize strings for an external symbol. | |
| virtual std::optional< DerivedString > | RecognizeImport (const HighLevelILInstruction &instr, Type *type, int64_t val) |
| Can be overridden to recognize strings for an imported symbol. | |
| Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNStringRecognizer > | |
| StaticCoreRefCountObject () | |
| virtual | ~StaticCoreRefCountObject () |
| BNStringRecognizer * | GetObject () const |
| void | AddRef () |
| void | Release () |
| void | AddRefForRegistration () |
| void | AddRefForCallback () |
| void | ReleaseForCallback () |
Static Public Member Functions | |
| static void | Register (StringRecognizer *recognizer) |
| Registers the string recognizer. | |
| static Ref< StringRecognizer > | GetByName (const std::string &name) |
| static std::vector< Ref< StringRecognizer > > | GetRecognizers () |
| StringRecognizer::StringRecognizer | ( | const std::string & | name | ) |
◆ StringRecognizer() [2/2]
◆ GetName()
| string StringRecognizer::GetName | ( | ) | const |
◆ IsValidForType()
Determines if the string recognizer should be called for the given expression type.
It is optional to override this method. If the method isn't overridden, all expression types are passed to the string recognizer.
- Parameters
- Returns
trueif the expression should be passed to the string recognizer,falseotherwise
Reimplemented in BinaryNinja::CoreStringRecognizer.
◆ RecognizeConstant()
Can be overridden to recognize strings for a constant that is not a pointer.
The expression type and value of the expression are given. If no string is found for this expression, this method should return std::nullopt
If a string is found, return a DerivedString with the string information.
- Parameters
-
instr High level expression type Type of the expression val Value of the expression
- Returns
- Optional
DerivedStringfor any string that is found
Reimplemented in BinaryNinja::CoreStringRecognizer.
◆ RecognizeConstantPointer()
Can be overridden to recognize strings for a constant pointer.
The expression type and value of the expression are given. If no string is found for this expression, this method should return std::nullopt
If a string is found, return a DerivedString with the string information.
- Parameters
-
instr High level expression type Type of the expression val Value of the expression
- Returns
- Optional
DerivedStringfor any string that is found
Reimplemented in BinaryNinja::CoreStringRecognizer.
◆ RecognizeExternPointer()
Can be overridden to recognize strings for an external symbol.
The expression type and value of the expression are given. If no string is found for this expression, this method should return std::nullopt
If a string is found, return a DerivedString with the string information.
- Parameters
-
instr High level expression type Type of the expression val Value of the expression offset Offset into the external symbol
- Returns
- Optional
DerivedStringfor any string that is found
Reimplemented in BinaryNinja::CoreStringRecognizer.
◆ RecognizeImport()
Can be overridden to recognize strings for an imported symbol.
The expression type and value of the expression are given. If no string is found for this expression, this method should return std::nullopt
If a string is found, return a DerivedString with the string information.
- Parameters
-
instr High level expression type Type of the expression val Value of the expression
- Returns
- Optional
DerivedStringfor any string that is found
Reimplemented in BinaryNinja::CoreStringRecognizer.
◆ Register()
|
static |
Registers the string recognizer.
- Parameters
-
recognizer The string recognizer to register.
◆ GetByName()
|
static |
◆ GetRecognizers()
|
static |