Is it possible, somehow, maybe by using some kind of brute force algorithm, to try and figure out what kind of file one is dealing with when one only has the raw binary without file format or meta information at all ?

If one wold use a tool such as Hopper Disassembler, how would one go about figuring out what kind of file one is dealing with?

  • $\begingroup$ You first of all need to have knowledge of all the possible file formats in the world, so that you can recognize them. I can think of machine learning and training our model by feeding every possible file format. $\endgroup$ – azam Feb 8 '16 at 11:53
  • $\begingroup$ A disassembler is the wrong tool here, since most files don't consist of machine code. $\endgroup$ – Yuval Filmus Feb 8 '16 at 12:58
  • $\begingroup$ This does not strike me as a computer science question -- at least not until you can restrict the input space to some extent and a conceptual problem remains. $\endgroup$ – Raphael Feb 8 '16 at 15:14
  • $\begingroup$ In general: no. Every binary format may have it's own representation - if I store my data in some not popular form, there is no way to reverse it, but if you pair program with file - you have file type. If you restrict it to only known formats but without magic number - you can, for textual formats it is easy, but neither dissasembler nor brute force is needed. $\endgroup$ – Evil Feb 8 '16 at 16:44
  • $\begingroup$ @Raphael correct, however I did not know which stack exchange subforum would better suit my question. Anyway, Eviljs answered the question pretty solid. If you could post your comment as answer, I can mark it as solution. $\endgroup$ – Michael Trouw Feb 9 '16 at 11:16