transform module

binaryninja.transform.Transform(handle)

class Transform allows users to implement custom transformations. New transformations may be added at runtime, so an instance of a transform is created like::.

binaryninja.transform.TransformParameter(name)

class Transform(handle)[source]

Bases: object

class Transform allows users to implement custom transformations. New transformations may be added at runtime, so an instance of a transform is created like:

>>> list(Transform)
[<transform: Zlib>, <transform: StringEscape>, <transform: RawHex>, <transform: HexDump>, <transform: Base64>, <transform: Reverse>, <transform: CArray08>, <transform: CArrayA16>, <transform: CArrayA32>, <transform: CArrayA64>, <transform: CArrayB16>, <transform: CArrayB32>, <transform: CArrayB64>, <transform: IntList08>, <transform: IntListA16>, <transform: IntListA32>, <transform: IntListA64>, <transform: IntListB16>, <transform: IntListB32>, <transform: IntListB64>, <transform: MD4>, <transform: MD5>, <transform: SHA1>, <transform: SHA224>, <transform: SHA256>, <transform: SHA384>, <transform: SHA512>, <transform: AES-128 ECB>, <transform: AES-128 CBC>, <transform: AES-256 ECB>, <transform: AES-256 CBC>, <transform: DES ECB>, <transform: DES CBC>, <transform: Triple DES ECB>, <transform: Triple DES CBC>, <transform: RC2 ECB>, <transform: RC2 CBC>, <transform: Blowfish ECB>, <transform: Blowfish CBC>, <transform: CAST ECB>, <transform: CAST CBC>, <transform: RC4>, <transform: XOR>]
>>> sha512=Transform['SHA512']
>>> rawhex=Transform['RawHex']
>>> rawhex.encode(sha512.encode("test string"))
'10e6d647af44624442f388c2c14a787ff8b17e6165b83d767ec047768d8cbcb71a1a3226e7cc7816bc79c0427d94a9da688c41a3992c7bf5e4d7cc3e0be5dbac'

Note that some transformations take additional parameters (most notably encryption ones that require a ‘key’ parameter passed via a dict):

>>> xor=Transform['XOR']
>>> rawhex=Transform['RawHex']
>>> xor.encode("Original Data", {'key':'XORKEY'})
>>> rawhex.encode(xor.encode("Original Data", {'key':'XORKEY'}))
b'173d3b2c2c373923720f242d39'
decode(input_buf, params={})[source]
encode(input_buf, params={})[source]
abstract perform_decode(data, params)[source]
abstract perform_encode(data, params)[source]
classmethod register()[source]
group = None
long_name = None
name = None
parameters = []
transform_type = None
class TransformParameter(name, long_name=None, fixed_length=0)[source]

Bases: object

property fixed_length

(read-only)

property long_name

(read-only)

property name

(read-only)