How does one extract the static API sequences of a PE file? I don't mean the imports listed in the imports segment.
I am currently using different RE tools like Ghidra, IDA Pro, and Binary Ninja. None of which I know has a built-in feature which allows me to extract the static API sequences.
[EDIT] I am looking for API call sequences without executing the binary. For example, maybe if the binary code contains file operations like fopen() → fwrite() → fclose() → fopen() → fwrite() → fclose(). I want to be able to extract this sequence of APIs.
CreateFile -> WriteFile -> CloseFile
?fwrite()
may only be called if some condition holds true or may only ever read a particular location under such condition. Could you elaborate what you want to achieve? In particular why is the sequence interesting? I can definitely see the charm of being able to see (external) library calls from a particular basic block/function. What does the sequence give you, when you know you can't properly get the sequence without certain runtime information.fopen()
, about four dozen calls tofwrite()
and anfclose()
. Now if one of thefwrite()
calls fails, I'd expect to land in the finalfclose()
. Additionally half of thefwrite()
calls may represent a different "mode" of sorts, compared to the other half. So depending on a function argument you'd either end up calling one or the other. Your proposed "sequence of calls" metric doesn't tell you anything about it. So what's the purpose and why does the sequence matter?