开发者

How to find the language from which an executable was compiled from?

Given a executable file (Windows, Linux or Mac OS X) of an application, is there a way to figure out the programming language that was used to write that application?开发者_运维问答


In the general case, I would think not. In a specific case, however, it might be possible.


Highly unlikely unless there is some specific metadata associated with it or some language specific feature associated with that exe. Executables are (usually) code compiled for a specific platform or intermediate code that will be just-in-time compiled for a specific language. In the case of JITed code you might be able to determine if its .NET or some other language that produces an intermediate code but for the most part this is a fairly difficult and unreasonable task. I could be wrong but from my understanding this isn't possible.


I might as well throw in a late answer.

Even if a compiler for a given programming language decides to throw out some metadata such as symbols in a data section with a message like "Compiled from Joe's C compiler version 4.1.104" nothing -- nothing at all stops me from writing a Go compiler that writes the same message into the same location in the data section to trick unsuspecting people looking at the executable.

Not to mention there are an infinite number of compilers that can be written for any given language.

And suppose we look at an executable containing just a few bytes.... say nothing more than incrementing a register. Hundreds of different languages admit compilers that in theory could optimize down to a metadata-free, single section executable.

The answer is simply no.

TL;DR: You can always spoof.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜