Loading...
Searching...
No Matches
BinaryNinja::CoreStringRecognizer Class Reference

Public Member Functions

 CoreStringRecognizer (BNStringRecognizer *recognizer)
bool IsValidForType (HighLevelILFunction *func, Type *type) override
 Determines if the string recognizer should be called for the given expression type.
std::optional< DerivedStringRecognizeConstant (const HighLevelILInstruction &instr, Type *type, int64_t val) override
 Can be overridden to recognize strings for a constant that is not a pointer.
std::optional< DerivedStringRecognizeConstantPointer (const HighLevelILInstruction &instr, Type *type, int64_t val) override
 Can be overridden to recognize strings for a constant pointer.
std::optional< DerivedStringRecognizeExternPointer (const HighLevelILInstruction &instr, Type *type, int64_t val, uint64_t offset) override
 Can be overridden to recognize strings for an external symbol.
std::optional< DerivedStringRecognizeImport (const HighLevelILInstruction &instr, Type *type, int64_t val) override
 Can be overridden to recognize strings for an imported symbol.
Public Member Functions inherited from BinaryNinja::StringRecognizer
 StringRecognizer (const std::string &name)
 StringRecognizer (BNStringRecognizer *renderer)
std::string GetName () const
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNStringRecognizer >
 StaticCoreRefCountObject ()
virtual ~StaticCoreRefCountObject ()
BNStringRecognizerGetObject () const
void AddRef ()
void Release ()
void AddRefForRegistration ()
void AddRefForCallback ()
void ReleaseForCallback ()

Additional Inherited Members

Static Public Member Functions inherited from BinaryNinja::StringRecognizer
static void Register (StringRecognizer *recognizer)
 Registers the string recognizer.
static Ref< StringRecognizerGetByName (const std::string &name)
static std::vector< Ref< StringRecognizer > > GetRecognizers ()
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNStringRecognizer >
std::atomic< int > m_refs
BNStringRecognizerm_object

Constructor & Destructor Documentation

◆ CoreStringRecognizer()

CoreStringRecognizer::CoreStringRecognizer ( BNStringRecognizer * recognizer)

Member Function Documentation

◆ IsValidForType()

bool CoreStringRecognizer::IsValidForType ( HighLevelILFunction * func,
Type * type )
overridevirtual

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
funcHighLevelILFunction representing the high level function to be queried
typeType of the expression
Returns
true if the expression should be passed to the string recognizer, false otherwise

Reimplemented from BinaryNinja::StringRecognizer.

◆ RecognizeConstant()

std::optional< DerivedString > CoreStringRecognizer::RecognizeConstant ( const HighLevelILInstruction & instr,
Type * type,
int64_t val )
overridevirtual

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
instrHigh level expression
typeType of the expression
valValue of the expression
Returns
Optional DerivedString for any string that is found

Reimplemented from BinaryNinja::StringRecognizer.

◆ RecognizeConstantPointer()

std::optional< DerivedString > CoreStringRecognizer::RecognizeConstantPointer ( const HighLevelILInstruction & instr,
Type * type,
int64_t val )
overridevirtual

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
instrHigh level expression
typeType of the expression
valValue of the expression
Returns
Optional DerivedString for any string that is found

Reimplemented from BinaryNinja::StringRecognizer.

◆ RecognizeExternPointer()

std::optional< DerivedString > CoreStringRecognizer::RecognizeExternPointer ( const HighLevelILInstruction & instr,
Type * type,
int64_t val,
uint64_t offset )
overridevirtual

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
instrHigh level expression
typeType of the expression
valValue of the expression
offsetOffset into the external symbol
Returns
Optional DerivedString for any string that is found

Reimplemented from BinaryNinja::StringRecognizer.

◆ RecognizeImport()

std::optional< DerivedString > CoreStringRecognizer::RecognizeImport ( const HighLevelILInstruction & instr,
Type * type,
int64_t val )
overridevirtual

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
instrHigh level expression
typeType of the expression
valValue of the expression
Returns
Optional DerivedString for any string that is found

Reimplemented from BinaryNinja::StringRecognizer.