I
I
Ivan Pavlov2016-10-27 11:17:53
reverse engineering
Ivan Pavlov, 2016-10-27 11:17:53

How to parse a binary file if you don't know its structure?

Hello! There is a file about which it is known only that it is saved as binary (according to official data). It is necessary to change a piece of data in it, but there is no information about exactly where (from which position) to start changing the data.
Actually, there are several questions:
1. If the file is saved as binary, it should not be readable using ordinary text editors like notepad?
2. If the readable text is still present, does this mean that the file is not saved as binary?
3. Is it possible to change the data in a file without knowing anything about its structure, like the usual Replace in a text editor?
4. Will the file be damaged if it was not saved as text, but, for example, by serializing a class or structure? As far as I know, when serializing a class, all sorts of "service" information is usually added to the file in the form of additional spaces between the data and other unreadable characters. And if this kind of "information" is deleted, the file will be damaged and will not open, or it will not open as it should.
5. Are there analyzers that can create a programmatic structure from the data that was used to save? Yes, I know it's unrealistic, but it could be.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2018-07-03
@2ord

1. Notepad does not display special characters. To view binary files, select special viewers / editors that display hexadecimal codes. Notepad, when saving a binary file, corrupts its structure by adding characters for a line feed.
2. No, the presence of readable character sequences does not automatically mean that the file is binary. It just might make it easier to parse the file.
3. No, you shouldn't do that.
4. Yes, the structure will be damaged.
5. I myself am interested to know if there are such. There is software that can analyze the contents of a file and determine what format it is from a list of known ones. If the format is open and there is documentation for it, then nothing prevents you from creating code generation software. For example, the protobuf library allows if the file structure is described in the protobuf language.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question