Take the 2-minute tour ×
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It's 100% free, no registration required.

How to understand if exe/dll is written in C++/.Net/Java or in any other language. I tried to use Dependency walker but not able to get required information.

share|improve this question
    
Usually the compiler used to build the executable file leave some explicit strings about itself. Try to look at the extra sections left in the executable. And, second, if no explicit tag is left, you will be able to deduce the original language (and probably the compiler) by recognizing the ABI used to produce the assembler. –  perror Jan 5 at 9:35
    
It's worthwhile to remember that a program can be written in more than one languages and then converted or exported to a binary. –  CppLearner Jan 10 at 23:01
    
Mandiant's Red Curtain had this functionality, wonder if you can reverse what they did there? –  atdre Feb 22 at 14:46

6 Answers 6

up vote 22 down vote accepted

(reposting my SO answer to a similar question)

In many cases it is possible to identify the compiler used to compile the code, and from that, the original language.

Most language implementations include some kind of runtime library to implement various high-level operations of the language. For example, C has the CRT which implements file I/O operations (fopen, fread etc.), Delphi has compiler helpers for its string type (concatenation, assignment and others), ADA has various low-level functions to ensure language safety and so on. By comparing the code of the program and the runtime libraries of the candidate compilers you may be able to find a match.

IDA implements this approach in the FLIRT technology. By using the signatures, IDA is able to determine most of the major compilers for DOS and Windows. It's somewhat more difficult on Linux because there's no single provider of compiler binaries for it, so signatures would have to be made for every distro.

However, even without resorting to the runtime library code, it may be possible to identify the compiler used. Many compilers use very distinct idioms to represent various operations. For example, I was able to guess that the compiler used for the Duqu virus was Visual C++, which was later confirmed.

share|improve this answer
  1. .NET could be identified by import which you can see using dependency warker - check if there is an import of mscorlib.dll which is a core lib of .net framework.
  2. C++ can be identified by
    1. looking at the assembly - it uses this call convention.
    2. PEid can show partial info about what compiler and run-time were used. In general it uses list of signature for that.
    3. Detect It Easy - this tool is still maintained and has pretty interesting features.
share|improve this answer

Marco Pontello's TrID software can usually identify what was used to compile a file.

share|improve this answer
    
Note: free for non-commercial use only –  Thomas W. Jan 5 at 21:08

Stud_PE (free) scans a lot of signatures of PE files (.EXEs and .DLLs).

share|improve this answer

Java bytecode files can be identified by their magic number: 0xCAFEBABE at the beginning of the file. Also the standard naming convention is to have these files' names end in .class.

share|improve this answer

You can detect a .net assembly by looking at the PE headers. Read the CLR spec and the PE/COFFEE spec for details.

Java uses it's own class file format. I'm not too familiar with it, but it should be possible to positively id a class file.

Native language development is mostly about heuristics. Things like calling conventions, prologues, epilogues, etc. A recursive descent disassembled, plus an idiom recognizer can likely id the source compiler. GCC and class generate very distinctive code, for example.

share|improve this answer

protected by AsheeshR Jan 11 at 6:03

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.