flat assembler
Message board for the users of flat assembler.

Index > Windows > File color visualizer

Author
Thread Post new topic Reply to topic
Flier-Mate



Joined: 26 May 2023
Posts: 88
Flier-Mate 07 Aug 2023, 08:10
I derive my hexdump utility to become color dump utility.

Now it analyze binary file and text file and gives distinct color.

From what I found, the ANSI escape code in Linux and Windows programming is a bit different,
Code:
colorblue db   27,'[48;5;33m'   ; ANSI escape code           


Windows is separated by semicolon, not colon.

I have attached the COLORDUMP.asm initial release to here, work well in CMD and PS.

Feedbacks are welcome!


Description: Text file analysis
Filesize: 69.68 KB
Viewed: 2418 Time(s)

text.png


Description: Binary file analysis
Filesize: 59.55 KB
Viewed: 2418 Time(s)

bin.png


Description: Alpha version: v0.01
Download
Filename: COLORDUMP.asm
Filesize: 8.53 KB
Downloaded: 1509 Time(s)

Post 07 Aug 2023, 08:10
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 715
Ali.Z 07 Aug 2023, 13:19
I used visual analyzers in past, especially in reverse engineering.

I havent seen the source, but it is poor to visually analyze files using ansi color.
it is much better to use 8bpc, unpack each byte into three components for every pixel.
the width can be 32 or 64 pixels, which is usually good. (i.e. max row is 32 / 64 pixels)

do keep in mind result may vary based in how do you unpack each channel.

_________________
Asm For Wise Humans
Post 07 Aug 2023, 13:19
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 715
Ali.Z 07 Aug 2023, 13:27
also note that if you have written a disassembler, you can color pixels based on the instruction type, e.g. data transfer instructions like mov may be colored white or blue, control flow such as jmp, jcc, call to yellow color... etc.

but this is a much more complex project.

_________________
Asm For Wise Humans
Post 07 Aug 2023, 13:27
View user's profile Send private message Reply with quote
Flier-Mate



Joined: 26 May 2023
Posts: 88
Flier-Mate 07 Aug 2023, 13:38
Ali.Z wrote:
I used visual analyzers in past, especially in reverse engineering.

I havent seen the source, but it is poor to visually analyze files using ansi color.
it is much better to use 8bpc, unpack each byte into three components for every pixel.
the width can be 32 or 64 pixels, which is usually good. (i.e. max row is 32 / 64 pixels)

do keep in mind result may vary based in how do you unpack each channel.


I am glad finally someone replied. ANSI color is the best I can do, I don't know GDI or other Windows graphics programming.


Description: PNG image file analysis (mixture of four colors)
Filesize: 94.46 KB
Viewed: 2388 Time(s)

png.png


Description: UTF-8 file analysis (confirmed no blue color)
Filesize: 87.01 KB
Viewed: 2388 Time(s)

utf8.png


Post 07 Aug 2023, 13:38
View user's profile Send private message Reply with quote
Flier-Mate



Joined: 26 May 2023
Posts: 88
Flier-Mate 07 Aug 2023, 13:40
Ali.Z wrote:
also note that if you have written a disassembler, you can color pixels based on the instruction type, e.g. data transfer instructions like mov may be colored white or blue, control flow such as jmp, jcc, call to yellow color... etc.

but this is a much more complex project.


Interesting, yes, I think it can be done in the future. Thanks for the idea!
Post 07 Aug 2023, 13:40
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 715
Ali.Z 07 Aug 2023, 14:17
Flier-Mate wrote:
I don't know GDI or other Windows graphics programming.


generally you would draw in response to wm_paint, unless you force it by invalidaterect, typical functions used for drawing are createdibsection createcompatibledc and bitblt.

but I might be missing some as I havent done any drawing in ages, refer to charles petzold examples for more information.

edit:
if you know nothing about the nature of graphics programming and the event driven system, get charles petzold's book or study his examples. (all in C language)

p.s. they are really good, I suggest converting all of his examples or most to fasm for learning purposes.
good luck.

_________________
Asm For Wise Humans
Post 07 Aug 2023, 14:17
View user's profile Send private message Reply with quote
Flier-Mate



Joined: 26 May 2023
Posts: 88
Flier-Mate 07 Aug 2023, 15:01
Ali.Z wrote:
Flier-Mate wrote:
I don't know GDI or other Windows graphics programming.


generally you would draw in response to wm_paint, unless you force it by invalidaterect, typical functions used for drawing are createdibsection createcompatibledc and bitblt.

but I might be missing some as I havent done any drawing in ages, refer to charles petzold examples for more information.

edit:
if you know nothing about the nature of graphics programming and the event driven system, get charles petzold's book or study his examples. (all in C language)

p.s. they are really good, I suggest converting all of his examples or most to fasm for learning purposes.
good luck.


Thank you for the suggestion, I do interested in graphics programming, and I think converting C code to FASM shouldn't be difficult if they use Windows API.

But currently my focus is on learning malware analysis, or reverse-engineering like you. Smile
Post 07 Aug 2023, 15:01
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 715
Ali.Z 07 Aug 2023, 15:19
forgot to mention:
book name:
https://www.charlespetzold.com/pw5/
examples:
https://www.charlespetzold.com/src/ProgWin5.zip

p.s. RE may be difficult for some, at least to some extent but surely pays for itself in the long run.

edit:
when learning win32 programming it helps a lot to have some offline reference like win32.hlp and setup fasm to auto launch hlp viewer within the ide.
if you dont have hlp viewer and hlp file then you can rip the viewer from windows xp and the hlp file from old microsoft products or even borland's.

_________________
Asm For Wise Humans
Post 07 Aug 2023, 15:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.