pythonida

How to find the main() function using IDAPython


I don't know how to find the main() function using IDAPython.

How can I do this?


Solution

  • Run this in the python console of IDA, and it will print the address of a function named main

    for funcAddr in idautils.Functions():
        funcName = idc.get_func_name(funcAddr)
        if funcName == 'main':
            print(f"{funcAddr:#x}")