flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > a hex viewer in FASM Goto page 1, 2 Next |
Author |
|
int0x50 02 Jul 2023, 06:01
i wrote a hex viewer in FASM ..
it's simple .. displays the hex values and ASCII for the file ...
|
||||||||||
02 Jul 2023, 06:01 |
|
revolution 02 Jul 2023, 06:02
Where is the source?
|
|||
02 Jul 2023, 06:02 |
|
int0x50 02 Jul 2023, 06:08
@revolution .. i have not hosted the source .. shall put it on Github soon and share it ...
|
|||
02 Jul 2023, 06:08 |
|
revolution 02 Jul 2023, 06:13
Post it here.
Code: ; source goes here |
|||
02 Jul 2023, 06:13 |
|
Flier-Mate 02 Jul 2023, 08:13
I think space (0x20) can also be printable, format-hex cmdlet in PowerShell, for example, prints the white space in hexdump.
64-bit code is nice, I see you use printf to also convert to hexadecimal values. |
|||
02 Jul 2023, 08:13 |
|
int0x50 02 Jul 2023, 08:28
@Flier-Mate, thanks ..
"I see you use printf to also convert to hexadecimal values." -> you are suggesting any alternative ? thanks for pointing the space .. changed the code to include whitespace ...
|
||||||||||
02 Jul 2023, 08:28 |
|
Flier-Mate 02 Jul 2023, 08:36
int0x50 wrote: @Flier-Mate, thanks .. You're most welcomed! If you don't use printf, you can consider Tomasz's routine to convert number to hex, in his video: https://www.youtube.com/watch?v=WceSGixAWSg&list=PLXIsc9dApNXogHjSTIqbhvYBw5WODn7Yb&index=9 Tomasz Grysztar wrote: In one of the parts of my video tutorial I show an implementation of a "ShowHex" routine in detail. Even though it is shown under Windows, these instructions and snippets are not really OS-dependent. |
|||
02 Jul 2023, 08:36 |
|
Flier-Mate 02 Jul 2023, 21:52
I suggest can also do color visualization tool based on hex viewer.
For example, see attached picture. But then my question is, what color code to be assigned to each byte? Binary file and text file might end up distinct colors. Any ideas? If I understand correctly, color visualization analysis can also tell whether a file is encrypted or not (by judging from how random the color )?
|
||||||||||
02 Jul 2023, 21:52 |
|
int0x50 03 Jul 2023, 02:46
@Flier-Mate
that's a great suggestion .. shall add this option too .. 'If I understand correctly, color visualization analysis can also tell whether a file is encrypted or not (by judging from how random the color )?" -> I think you are talking about entropy ... you are right, the more unique values, the more chances of file being compressed (or packed) ... but yes, i think should apply your idea ... we need to assign 256 unique colors to the values ...if it's graphics mode, i think we can bring in variation ... |
|||
03 Jul 2023, 02:46 |
|
Flier-Mate 03 Jul 2023, 05:50
int0x50 wrote: @Flier-Mate The example color visualization is the result of using "SGR escape sequence", according to the repo owner. It is not graphics mode I think. But what color map to have for these 256 bytes is an interesting question. |
|||
03 Jul 2023, 05:50 |
|
int0x50 27 Jul 2023, 01:27
the speed of the Format-Hex command (Windows Powershell) is very fast compared to the one I have written ...
what could be the reasons? my code is hosted at https://github.com/vlabsc/file_in_hex |
|||
27 Jul 2023, 01:27 |
|
bitRAKE 27 Jul 2023, 03:58
Windows Powershell Format-Hex looks like they are processing 16 bytes at a time (not printf()) and then outputting the whole line. Changing your code to a single printf() per line (using SIMD to convert the bytes) should be sufficient to beat PowerShell.
Having a single printf() should make changing the line layout quite easy as well: Code: printf <"0x%08x [ %s ] [ %s ]",13,10>,\ dword [row_address_print], addr hex_buffer, addr filter_string Code: printf <"%08X: %s | %s",13,10>, \ dword [row_address_print], addr hex_buffer, addr filter_string |
|||
27 Jul 2023, 03:58 |
|
int0x50 27 Jul 2023, 06:50
@bitRAKE .. i am missing something ...
when you use %s it's going to print characters until it sees a NULL byte right? how is that this prints only 16bytes only ? printf <"%08X: %s | %s",13,10>, dword [row_address_print], addr hex_buffer, addr filter_string |
|||
27 Jul 2023, 06:50 |
|
bitRAKE 27 Jul 2023, 17:00
I left out the code for the two functions that translate the data.
Code: hex_buffer rb 48 db 0 ; null terminate hexadecimal bytes filter_string rb 16 db 0 ; null terminate filtered bytes Both translations can be done with SIMD - the filtering of the bytes and the conversion to hexadecimal. There are many threads on the board about hexadecimal conversion. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
27 Jul 2023, 17:00 |
|
int0x50 30 Jul 2023, 02:09
@bitRAKE ... i modified the code as per you idea and now it's much faster than powershell ...
earlier, i called printf 32 times per row and now calling it only twice per row ... used bit operations, xlatb ... much precise information on performance, i shall post soon .. it's almost 8 times faster now .. new code: https://raw.githubusercontent.com/vlabsc/file_in_hex/main/printhex.asm |
|||
30 Jul 2023, 02:09 |
|
int0x50 30 Jul 2023, 03:30
measured the time through powershell
|
|||||||||||||||||||
30 Jul 2023, 03:30 |
|
Flier-Mate 30 Jul 2023, 13:05
Can your hex viewer / PE parser run in Command Prompt? I encountered filename parsing error the other day.
|
|||
30 Jul 2023, 13:05 |
|
int0x50 30 Jul 2023, 13:48
@Flier-Mate ... yes it runs over command prompt ...
the command yes fih.exe <filename> ... pleas let me know what error you get .. |
|||
30 Jul 2023, 13:48 |
|
Flier-Mate 30 Jul 2023, 14:09
int0x50 wrote: @Flier-Mate ... yes it runs over command prompt ... I got this error in Commnad Prompt, but okay in PowerShell. Quote: C:\Users\BOO\Projects\file_in_hex>fih \windows\write.exe Also, your latest fih.asm has typo, "printf" is misspelled as "printn". |
|||
30 Jul 2023, 14:09 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.