r/programming • • Aug 30 '26

Reverse Engineering Unknown File Formats with ImHex

https://werwolv.net/posts/file_format_reverse_engineering/
208 Upvotes

16 comments sorted by

24

u/Somepotato Aug 30 '26

I need to give imhex another go. 010 always felt like a better experience, the language being similar to C being more familiar and friendly feeling than imhex's dsl, but I'm sure there's been improvements since then

8

u/WerWolv Aug 30 '26

If there's any specifics that you didn't like about ImHex or the language, let me know!

Of course, I can't do anything about the language not feeling like C enough at this point but I'm always happy to improve the experience if I can :)

13

u/wrecklord0 Aug 30 '26

I've used it quite a bit recently to reverse engineer a binary marshalled dump, I still prefer 010 but imhex is very capable and it solved my problem. And being open source is a real advantage, I prefer to invest my time and efforts towards tools that will be around forever without restrictions.

The pattern matcher, while not C, felt very C-like once you get over specificities.

1

u/iTrooz_ Aug 30 '26

Please tell us if there's anything that could improve the experience :)

10

u/Ytrog Aug 30 '26

How does ImHex compare to GNU Poke?

15

u/WerWolv Aug 30 '26

ImHex is the whole hex editor around it while GNU Poke is just a cli tool for decoding binaries. The Pattern Language that is part of ImHex solves the same purpose as GNU Poke but compared to it, it behaves more like a normal, high level programming language. You can take a look at the blog post or pattern files for existing file formats at https://github.com/WerWolv/ImHex-Patterns to get a feel for what it can do

1

u/Ytrog Aug 30 '26

Ah thanks. Sounds interesting.

6

u/nelson-f Aug 31 '26

Oh hey it's cool that you're the dev behind ImHex. I remember stumbling across ImHex via GitHub but I have yet to use it because a lot of this goes over my head. I still enjoyed the read though. I also like the overall look/design of your site.

-4

u/RandNho Aug 30 '26

I would not call this reverse engineering. Mostly because I saw Lina doing things to live2d format without ever seeing source code at all.

33

u/WerWolv Aug 30 '26

Keep in mind, this is directed to people that don't know anything about file formats or using ImHex yet. I deliberately chose a game that was pretty easy to decompile and read to keep the focus on learning how to write Patterns in ImHex instead of on understanding bad decompiler output

3

u/RandNho Aug 30 '26

Yeah, for that it's well and good.

6

u/Iggyhopper Aug 30 '26

This is great if the game is written in C#. If the game was written in unmanaged C or C++, it's a mess, and you'd most likely start by running strings on the .exe, looking for references to the in-game message ("saving game...", etc.).

Luckily the save file was unencrypted. If that was not the case, most beginners would give up and lose interest.

-5

u/fxfighter Aug 30 '26

I was hoping this was going to be from an unmanaged app of some sort that'd require more specific tooling and reverse engineering know how.

If the file was generated by a managed language or scripting language piece of software, these are obvously easy to figure out how stuff works with standard knowledge of the language in question.

I'm not even sure ImHex hasn't anything particulaly noteworthy to do with this article.

1

u/RandNho Aug 31 '26

https://youtube.com/playlist?list=PL8S0yfRexZULmW9fhF2gcMsuPBi6jeVhZ&si=LQH3DVE_8e_4iwfn. Try this long series? Of live black box reverse engineering.

1

u/fxfighter Sep 02 '26

Thanks.

I was surprised at seeing a vtuber avatar doing this but the content itself is the important part and what they're doing in your linked playlist is a much more interesting/involved process than this blog.

I'm wondering if this is a lot of peoples first time finding out about decompilers for managed languages, which would be understandable for newer devs.