Loading...
Searching...
No Matches
Transform

Detailed Description

Classes

struct  BinaryNinja::TransformParameter
 
class  BinaryNinja::Transform
 Allows users to implement custom transformations. More...
 
class  BinaryNinja::CoreTransform
 

Class Documentation

◆ BinaryNinja::TransformParameter

struct BinaryNinja::TransformParameter
Class Members
string name
string longName
size_t fixedLength

◆ BinaryNinja::Transform

class BinaryNinja::Transform

Allows users to implement custom transformations.

New transformations may be added at runtime, so an instance of a transform is created like

DataBuffer inputData = binaryView->ReadBuffer(0, 32); // Read the first 32 bytes of the file
DataBuffer outputDataHash;
Transform::GetByName("SHA512")->Encode(inputData, outputDataHash); // Writes the SHA512 hash to outputDataHash
Definition binaryninjaapi.h:2072
static Ref< Transform > GetByName(const std::string &name)
Definition transform.cpp:145

Getting a list of registered transforms:

From the interactive python console:

list(Transform)

At Runtime:

std::vector<Ref<Transform>> registeredTypes = Transform::GetTransformTypes();
static std::vector< Ref< Transform > > GetTransformTypes()
Definition transform.cpp:154

Public Member Functions

 Transform (BNTransformType type, const std::string &name, const std::string &longName, const std::string &group)
 
BNTransformType GetType () const
 
std::string GetName () const
 
std::string GetLongName () const
 
std::string GetGroup () const
 
virtual std::vector< TransformParameterGetParameters () const
 
virtual bool Decode (const DataBuffer &input, DataBuffer &output, const std::map< std::string, DataBuffer > &params=std::map< std::string, DataBuffer >())
 
virtual bool Encode (const DataBuffer &input, DataBuffer &output, const std::map< std::string, DataBuffer > &params=std::map< std::string, DataBuffer >())
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNTransformGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static void Register (Transform *xform)
 
static Ref< TransformGetByName (const std::string &name)
 
static std::vector< Ref< Transform > > GetTransformTypes ()
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
static BNTransformGetObject (StaticCoreRefCountObject *obj)
 

Protected Member Functions

 Transform (BNTransform *xform)
 

Static Protected Member Functions

static BNTransformParameterInfoGetParametersCallback (void *ctxt, size_t *count)
 
static void FreeParametersCallback (BNTransformParameterInfo *params, size_t count)
 
static bool DecodeCallback (void *ctxt, BNDataBuffer *input, BNDataBuffer *output, BNTransformParameter *params, size_t paramCount)
 
static bool EncodeCallback (void *ctxt, BNDataBuffer *input, BNDataBuffer *output, BNTransformParameter *params, size_t paramCount)
 
static std::vector< TransformParameterEncryptionKeyParameters (size_t fixedKeyLength=0)
 
static std::vector< TransformParameterEncryptionKeyAndIVParameters (size_t fixedKeyLength=0, size_t fixedIVLength=0)
 

Protected Attributes

BNTransformType m_typeForRegister
 
std::string m_nameForRegister
 
std::string m_longNameForRegister
 
std::string m_groupForRegister
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
std::atomic< int > m_refs
 
BNTransformm_object
 

Constructor & Destructor Documentation

◆ Transform() [1/2]

Transform::Transform ( BNTransform * xform)
protected

◆ Transform() [2/2]

BinaryNinja::Transform::Transform ( BNTransformType type,
const std::string & name,
const std::string & longName,
const std::string & group )

Member Function Documentation

◆ GetParametersCallback()

BNTransformParameterInfo * Transform::GetParametersCallback ( void * ctxt,
size_t * count )
staticprotected

◆ FreeParametersCallback()

void Transform::FreeParametersCallback ( BNTransformParameterInfo * params,
size_t count )
staticprotected

◆ DecodeCallback()

bool Transform::DecodeCallback ( void * ctxt,
BNDataBuffer * input,
BNDataBuffer * output,
BNTransformParameter * params,
size_t paramCount )
staticprotected

◆ EncodeCallback()

bool Transform::EncodeCallback ( void * ctxt,
BNDataBuffer * input,
BNDataBuffer * output,
BNTransformParameter * params,
size_t paramCount )
staticprotected

◆ EncryptionKeyParameters()

vector< TransformParameter > Transform::EncryptionKeyParameters ( size_t fixedKeyLength = 0)
staticprotected

◆ EncryptionKeyAndIVParameters()

vector< TransformParameter > Transform::EncryptionKeyAndIVParameters ( size_t fixedKeyLength = 0,
size_t fixedIVLength = 0 )
staticprotected

◆ Register()

void Transform::Register ( Transform * xform)
static

◆ GetByName()

Ref< Transform > Transform::GetByName ( const std::string & name)
static

◆ GetTransformTypes()

vector< Ref< Transform > > Transform::GetTransformTypes ( )
static

◆ GetType()

BNTransformType Transform::GetType ( ) const

◆ GetName()

string Transform::GetName ( ) const

◆ GetLongName()

string Transform::GetLongName ( ) const

◆ GetGroup()

string Transform::GetGroup ( ) const

◆ GetParameters()

vector< TransformParameter > Transform::GetParameters ( ) const
virtual

Reimplemented in BinaryNinja::CoreTransform.

◆ Decode()

bool Transform::Decode ( const DataBuffer & input,
DataBuffer & output,
const std::map< std::string, DataBuffer > & params = std::map<std::string, DataBuffer>() )
virtual

Reimplemented in BinaryNinja::CoreTransform.

◆ Encode()

bool Transform::Encode ( const DataBuffer & input,
DataBuffer & output,
const std::map< std::string, DataBuffer > & params = std::map<std::string, DataBuffer>() )
virtual

Reimplemented in BinaryNinja::CoreTransform.

Member Data Documentation

◆ m_typeForRegister

BNTransformType BinaryNinja::Transform::m_typeForRegister
protected

◆ m_nameForRegister

std::string BinaryNinja::Transform::m_nameForRegister
protected

◆ m_longNameForRegister

std::string BinaryNinja::Transform::m_longNameForRegister
protected

◆ m_groupForRegister

std::string BinaryNinja::Transform::m_groupForRegister
protected

◆ BinaryNinja::CoreTransform

class BinaryNinja::CoreTransform

Public Member Functions

 CoreTransform (BNTransform *xform)
 
virtual std::vector< TransformParameterGetParameters () const override
 
virtual bool Decode (const DataBuffer &input, DataBuffer &output, const std::map< std::string, DataBuffer > &params=std::map< std::string, DataBuffer >()) override
 
virtual bool Encode (const DataBuffer &input, DataBuffer &output, const std::map< std::string, DataBuffer > &params=std::map< std::string, DataBuffer >()) override
 
- Public Member Functions inherited from BinaryNinja::Transform
 Transform (BNTransformType type, const std::string &name, const std::string &longName, const std::string &group)
 
BNTransformType GetType () const
 
std::string GetName () const
 
std::string GetLongName () const
 
std::string GetGroup () const
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNTransformGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::Transform
static void Register (Transform *xform)
 
static Ref< TransformGetByName (const std::string &name)
 
static std::vector< Ref< Transform > > GetTransformTypes ()
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
static BNTransformGetObject (StaticCoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTransform >
std::atomic< int > m_refs
 
BNTransformm_object
 
- Protected Member Functions inherited from BinaryNinja::Transform
 Transform (BNTransform *xform)
 
- Static Protected Member Functions inherited from BinaryNinja::Transform
static BNTransformParameterInfoGetParametersCallback (void *ctxt, size_t *count)
 
static void FreeParametersCallback (BNTransformParameterInfo *params, size_t count)
 
static bool DecodeCallback (void *ctxt, BNDataBuffer *input, BNDataBuffer *output, BNTransformParameter *params, size_t paramCount)
 
static bool EncodeCallback (void *ctxt, BNDataBuffer *input, BNDataBuffer *output, BNTransformParameter *params, size_t paramCount)
 
static std::vector< TransformParameterEncryptionKeyParameters (size_t fixedKeyLength=0)
 
static std::vector< TransformParameterEncryptionKeyAndIVParameters (size_t fixedKeyLength=0, size_t fixedIVLength=0)
 
- Protected Attributes inherited from BinaryNinja::Transform
BNTransformType m_typeForRegister
 
std::string m_nameForRegister
 
std::string m_longNameForRegister
 
std::string m_groupForRegister
 

Constructor & Destructor Documentation

◆ CoreTransform()

CoreTransform::CoreTransform ( BNTransform * xform)

Member Function Documentation

◆ GetParameters()

vector< TransformParameter > CoreTransform::GetParameters ( ) const
overridevirtual

Reimplemented from BinaryNinja::Transform.

◆ Decode()

bool CoreTransform::Decode ( const DataBuffer & input,
DataBuffer & output,
const std::map< std::string, DataBuffer > & params = std::map<std::string, DataBuffer>() )
overridevirtual

Reimplemented from BinaryNinja::Transform.

◆ Encode()

bool CoreTransform::Encode ( const DataBuffer & input,
DataBuffer & output,
const std::map< std::string, DataBuffer > & params = std::map<std::string, DataBuffer>() )
overridevirtual

Reimplemented from BinaryNinja::Transform.