Introduction
EDIT: Hex editing is now implemented!
Let me introduce my new baby to you, hexcess! It's a TUI hex viewer, and soon editor as I'm still working on it! The edit feature will (probably) be available next week! It was initially a project idea I had when I was participating in some CTF and I needed to modify some file signatures to be able to open the file.
Why C and Ncurses
I initially wanted to write it in Rust with the Ratatui library, however I ended up using C and Ncurses instead. Why ?
-
Because I still haven't read the Rust book, so I don't feel comfortable making a project using a language I'm not familiar enough with. Learning how to correctly use the language and being familiar with the good practices before coding is something very important to me.
-
Although it got a little bit rusty, I used to program a lot in C when I was at School 19. Even though I had trouble remembering how to write a correct Makefile, Includes files, and how to use GCC correctly to compile with the library and use the flags to detect potential errors, I found my way through the depths of my memory and how to write code in C.
-
As an aspiring Reverse Engineer myself, I want to get used again to C to be able to understand the decompiled code generated by Ghidra or IDA.
-
I'm trying to apply for an internship at a nice company where C is heavily used (I hope they take me in)! This project is a nice way to highlight my skills in this language I guess ?
My experience using C again
It's been a while since I programmed in C, and one thing I had a hard time to get used to again is to make sure that I write secure code. I can't count how many times my program went out of bounds from the memory I allocated. This is probably a skill issue from my part, and a more experienced C programmer would probably make sure that the program never reads a single byte of memory past what it's supposed to have access to, but I think it's very easy to be distracted and not handle this correctly. I would have preferred to use a memory-safe and blazingly fast™ language like Rust. Maybe I will rewrite the this program in Rust sometimes!
Discovering Ncurses
Ncurses is quite simple and straightforward in my opinion, I still had a hard time starting to use this library correctly. There are some nice tutorials around, like this one from https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/, but I wasn't sure if I should use it since it hasn't been updated since 2005, I used it anyway since it was really well written and in-depth, along with the Ncurses man, because RTFM. In comparison, when I tried using Ratatui, I had a better experience learning the library thanks to the tutorial included in their website. I really recommend checking it out!
Conclusion
I still liked making this project, although I didn't plan on taking such a long time to write the code for it. Now that I have commited myself to writing this project in C and Ncurses, I will stick to it and try to push this project as far as I can! Here is the link to the repository, feel free to contribute!
If there is any mistake to report or you have any suggestion, feel free to open a PR in the repository.