'How to get the actual main address use idapython when starting IDA in batch mode?

When starting IDA in GUI mode to analyze the binary, it automatically locates and displays the actual main function code (not the entry point encapsulated by the compiler, but the main function corresponding to the source code).

My question is how to get that address in batch mode (without GUI) via idapython script? I don't see the relevant interface in the IDAPython documentation.

For example, _mainCRTStartup --> ___mingw_CRTStartup --> _main is a sequence of function calls, where _mainCRTStartup is the entry point of the binary, but I want to get the address of _main, can it be done?

Any help or direction would be much appreciated.!



Solution 1:[1]

Know the answer, it is idaapi.inf_get_main()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 uever