[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Clarification Re: Displaying an arbitrary file in _both_ HEX and ASCII



On Thu 23 Jan 2020 at 15:20:44 (-0600), Richard Owlett wrote:
> On 01/22/2020 07:12 AM, Richard Owlett wrote:
> > I'm running Debian 9.8 with MATE desktop.
> > I'm exploring a data file with the intention of eventually parsing
> > it in a useful fashion.
> > 
> > Just downloaded ghex. I like the display format.
> 
> I posted in two fora (here and a LUG mailing list).
> *NOBODY* picked up on two key features I presumed obvious ;/
>   1. For my problem domain, GUI is obvious way to go:
>      a. Intuitive (IMMHO) connection  of a selection in BOTH
>         the ASCII an HEX views

I've no idea what you mean by a selection.

>      b. Presumption that GUI is more intuitive for "quick n dirty"

No idea what you're talking about. When I examine a hex file, I run
a program to dump it to standard output which I pipe into less.
GUIs usually have buttons and listboxes and things. I'm not sure
what you want them to do.

>      c. I gave an example of a GUI application I had downloaded
>         as it had appeared to meet many of my needs/preferences.

Did you? You wrote that you liked the display format of ghex, from
which I presumed that it's a program for displaying hex. Why would
I assume that it's a GUI? A quick grep on my system shows that I've
never installed any package containing the string "ghex" (going back
as far as hamm in 1998). What I've missed …

>   2. I repeatedly mentioned/implied *DISPLAY*.

You did mention "display" twice, hence I chose a program that dumps.

>      I never even hinted at editing.

No, but you said you wanted to search. I outlined the problems with
searching a dumped representation (that has newlines inserted into
the display to make it readable) which can prevent searches from
working wherever the sequence of target bytes cross line boundaries.

$ hexdump -n 200 -v -e '/20  "%04_ax " "%4_ad: "' -e '20/1 "%02X "' -e '/20 " |"' -e '20/1 "%_p"' -e '/20 "|\n"' mc/Iguazupan.ogv 
0000    0: 4F 67 67 53 00 02 00 00 00 00 00 00 00 00 31 D3 E3 2B 00 00 |OggS..........1..+..|
0014   20: 00 00 81 A2 E3 A0 01 2A 80 74 68 65 6F 72 61 03 02 01 00 28 |.......*.theora....(|
0028   40: 00 1E 00 02 80 00 01 E0 00 00 00 05 C4 90 00 00 7F 37 00 00 |.................7..|
003c   60: 01 00 00 01 00 00 00 00 94 C0 4F 67 67 53 00 02 00 00 00 00 |..........OggS......|
0050   80: 00 00 00 00 80 EF 93 50 00 00 00 00 B1 CC 5E 28 01 1E 01 76 |.......P......^(...v|
0064  100: 6F 72 62 69 73 00 00 00 00 01 80 3E 00 00 00 00 00 00 80 BB |orbis......>........|
0078  120: 00 00 00 00 00 00 A9 01 4F 67 67 53 00 00 00 00 00 00 00 00 |........OggS........|
008c  140: 00 00 80 EF 93 50 01 00 00 00 7D CA 9E 40 0E 8A FF FF FF FF |.....P....}..@......|
00a0  160: FF FF FF FF FF FF FF FF C5 03 76 6F 72 62 69 73 2A 00 00 00 |..........vorbis*...|
00b4  180: 58 69 70 68 2E 4F 72 67 20 6C 69 62 56 6F 72 62 69 73 20 49 |Xiph.Org libVorbis I|
$ 

Thus, searching for '76 6F 72 62 69 73' will find the second
occurrence of 'vorbis' rather than the first; hence my recommendation
that you perform the searches with an editor on the original file,
which solves that problem. What's wrong with an editor? You don't
have to actually *change* anything in the file just because it's
called an "editor".

> > Its tools are inconvenient.
> 
> IOW
>   I *ABSOLUTELY* require DECIMAL arithmetic for offsets/location.
>   I observe a "bug/undocumented feature/operator error" in search.

Again, no idea what you're referring to here.

>     [I have "homework" to do ;]

You certainly have, if you want to perform 4 (below) on a simultaneous
display of hex and ascii without using an editor (which would make 3
a lot easier too).

> > I need to:
> >   1. Simultaneously display in _both_ HEX and ASCII format
> >   2. Know the current offset in *DECIMAL* format.
> >      {knowing the offset also in HEX might be nice}
> >   3. Goto to an offset - expressed in DECIMAL.
> >   4. Advance a specific number of bytes.
> >   5. Search for an ASCII string.
> >   6. Search for arbitrary sequence of bytes expressed as HEX.
> > 
> > Suggested tool(s) in Debian repository?
> > TIA

Cheers,
David.


Reply to: