binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

add example demonstrating custom Transform API

Open CX330Blake opened this issue 3 months ago • 2 comments

I want to right click and copy as python list like copy as C array. For example,

00404080  uint32_t check[0x1e] = 
00404080  {
00404080      [0x00] =  0x244b28be
00404084      [0x01] =  0x0af77805
00404088      [0x02] =  0x110dfc17
0040408c      [0x03] =  0x07afc3a1
00404090      [0x04] =  0x6afec533
00404094      [0x05] =  0x4ed659a2
00404098      [0x06] =  0x33c5d4b0
0040409c      [0x07] =  0x286582b8
004040a0      [0x08] =  0x43383720
004040a4      [0x09] =  0x055a14fc
004040a8      [0x0a] =  0x19195f9f
004040ac      [0x0b] =  0x43383720
004040b0      [0x0c] =  0x19195f9f
004040b4      [0x0d] =  0x747c9c5e
004040b8      [0x0e] =  0x0f3da237
004040bc      [0x0f] =  0x615ab299
004040c0      [0x10] =  0x6afec533
004040c4      [0x11] =  0x43383720
004040c8      [0x12] =  0x0f3da237
004040cc      [0x13] =  0x6afec533
004040d0      [0x14] =  0x615ab299
004040d4      [0x15] =  0x286582b8
004040d8      [0x16] =  0x055a14fc
004040dc      [0x17] =  0x3ae44994
004040e0      [0x18] =  0x06d7dfe9
004040e4      [0x19] =  0x4ed659a2
004040e8      [0x1a] =  0x0ccd4acd
004040ec      [0x1b] =  0x57d8ed64
004040f0      [0x1c] =  0x615ab299
004040f4      [0x1d] =  0x22e9bc2a
004040f8  }

can be copied as

data = [
    0x244b28be, 0x0af77805, 0x110dfc17, 0x07afc3a1,
    0x6afec533, 0x4ed659a2, 0x33c5d4b0, 0x286582b8,
    0x43383720, 0x055a14fc, 0x19195f9f, 0x43383720,
    0x19195f9f, 0x747c9c5e, 0x0f3da237, 0x615ab299,
    0x6afec533, 0x43383720, 0x0f3da237, 0x6afec533,
    0x615ab299, 0x286582b8, 0x055a14fc, 0x3ae44994,
    0x06d7dfe9, 0x4ed659a2, 0x0ccd4acd, 0x57d8ed64,
    0x615ab299, 0x22e9bc2a
]

CX330Blake avatar Nov 14 '25 17:11 CX330Blake

I don't know if we'll add that as a first-party feature, but you can add your own transform-api plugin that does the same thing if you like! I'll leave this open until we at least publish an example plugin that would be easier to demonstrate how to do it, but I don't know that we intend to add it as a built-in format.

psifertex avatar Nov 14 '25 17:11 psifertex

It's easier to automate some calculation if we can copy as Python list. Although it can be done by LLMs now haha.

CX330Blake avatar Nov 14 '25 19:11 CX330Blake