0

I am converting BN code into IDA Pro and stuck at this point, following are lines in the code which gives the symbol call

#####Get call symbol (if it exists)
dr.get_symbol(inst.tokens)

and

####### NOTE: Might contain FPs. E.g., "call [ebx + 0x4]"
#####Extract call symbol if it exists
def get_symbol(self, token):
    token = [str(t) for t in token]
    if '[' not in token:
         return

start = token.index('[')
end = token.index(']')
symbol = ' '.join(token[start+1:end])
self.api.append(symbol)

I want to convert the above code and want the following output in TXT file, but I am getting only strings and not in the register format like below.

Sample output:

---------------** 

 ++++++ API Features ++++++
    APIs: ebp + 0x8  { arg2 };eax;ecx;ecx + esi;ebp - 0x18  { var_1c }
 
++++++ API Features ++++++
    APIs: ebp + 0x8  { arg1 };edi
3
  • Hmm. I am sorry for not putting question properly. Sir, I have rewritten an existing code of BN into IDAPYTHON. In this step, i have done 1. networkx , mnemonic of instruction, basic block listing and getting assembly of each addresses. All my work is in initial phase. Now i am conversion symbol translation code into
    – Nav60
    Aug 8, 2021 at 18:31
  • IDAPYTON and got following code as a help from internet. symbols = {} for addr, name in idautils.Names(): symbols[addr] = name symbol.write( 'symbol at 0x%x is name %s\n' % (addr,name) ) and same problem is disused on the following link . reverseengineering.stackexchange.com/questions/9352/…. I am new in this field so please accept my mistakes .
    – Nav60
    Aug 8, 2021 at 18:35
  • 1
    You should edit the question instead of adding comments if something is wrong with it.
    – Igor Skochinsky
    Aug 9, 2021 at 5:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.