Extract String from known address in many files

Help on how to use HxD.
Post Reply
ezhxd
Posts: 3
Joined: 27 Apr 2020 07:25

Extract String from known address in many files

Post by ezhxd »

I have 100 files of different length and similar structure.
I want to extract 2 strings and send to text editor making list. The valid data inside string has different length. I use needed + some, 20 or more.
Address from
Hex _____1____ Length 20. This contains a file path\name.*** of different length. I don't care about surplus length.
Hex _____2____ Length 20. This contains a file path\name.*** of different length. I don't care about surplus length.

If the list could include the file name it would be great. I can manage without because I can see the order form the source file.
However there must be some sort of verification of output versus source file. Win10 orders files sometime a little odd.

HexAddresses: 00000640 and 00000700
I was trying to add a sample file. Your system seems to block correct extension *.sng. Zipped !

I am new to this program, used Hex Editor Nero free. HxD is better. Thanks for help, English or German.
Attachments
00HinterHuhnstallL.zip
(493 Bytes) Downloaded 684 times
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Extract String from known address in many files

Post by Maël »

If you are asking if there is a way to automate this, unfortunately there isn't, since there is no scripting support yet.

But it should be relatively easy to write a small program for this, using filestreams.

You could also try something similar to what was suggested here:
viewtopic.php?f=4&t=1092#p3370
ezhxd
Posts: 3
Joined: 27 Apr 2020 07:25

Re: Extract String from known address in many files

Post by ezhxd »

Thanks, learning to do this will certainly take much more time then manual operation: Open file, GoTo1, Copy+paste (LibreOffice), GoTo2 etc.
Alternative: Seek more free Hexies.
Digital is supposed to make repeated processes easier - ;-)
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Extract String from known address in many files

Post by Maël »

Sure, but all that functionality takes time to implement ;)
ezhxd
Posts: 3
Joined: 27 Apr 2020 07:25

Re: Extract String from known address in many files

Post by ezhxd »

I used NEO, recently HxD.
Now installed HexEdit, WinHex, xvi32
None of these offers any way to automate range extraction, even for 1 file. Extracting in folder - no way.
You can input a string and search for it and find location.
You can not input location and extract string.
I am not sure if a hex editor of Win3.1 was able to do it. :)
therube
Posts: 2
Joined: 05 Apr 2024 20:19

Re: Extract String from known address in many files

Post by therube »

How about a Strings type program?

(I'm arbitrarily setting a minimum string length of 9, but there are other ways to filter.)
strings.exe -n 9 00* > yyy

And with multiple input files, 00*, the file name would be shown in the redirected output (yyy).

(I renamed to your file name to "xxx", then copied to xxy & xxz.)

Code: Select all

C:\out\222\xxx: FFWZZZ\s<AFPd2
C:\out\222\xxx: @@@@@--#%%%(0
C:\out\222\xxx: @@@>@B@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ABB@@@@@@@@@@
C:\out\222\xxx: FFPcccU]PPPciZZP@@@@@@@@@@@@@@@@
C:\out\222\xxx: FF2222PZ<F<FF222nnddddnxZZZdddZZ
C:\out\222\xxx: P3P6Pa<$U*P,
C:\out\222\xxx: 00HinterHuhnstal
C:\out\222\xxx: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxy: FFWZZZ\s<AFPd2
C:\out\222\xxy: @@@@@--#%%%(0
C:\out\222\xxy: @@@>@B@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ABB@@@@@@@@@@
C:\out\222\xxy: FFPcccU]PPPciZZP@@@@@@@@@@@@@@@@
C:\out\222\xxy: FF2222PZ<F<FF222nnddddnxZZZdddZZ
C:\out\222\xxy: P3P6Pa<$U*P,
C:\out\222\xxy: 00HinterHuhnstal
C:\out\222\xxy: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxz: FFWZZZ\s<AFPd2
C:\out\222\xxz: @@@@@--#%%%(0
C:\out\222\xxz: @@@>@B@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ABB@@@@@@@@@@
C:\out\222\xxz: FFPcccU]PPPciZZP@@@@@@@@@@@@@@@@
C:\out\222\xxz: FF2222PZ<F<FF222nnddddnxZZZdddZZ
C:\out\222\xxz: P3P6Pa<$U*P,
C:\out\222\xxz: 00HinterHuhnstal
C:\out\222\xxz: 00Oberkrainer\00Hintermhuehner
With doing nothing further with that, you could parse it further with a grep-like command, say foreinstance that all the wanted data started with "00".

C:\out\222>grep.exe 00 yyy

Code: Select all

C:\out\222\xxx: 00HinterHuhnstal
C:\out\222\xxx: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxy: 00HinterHuhnstal
C:\out\222\xxy: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxz: 00HinterHuhnstal
C:\out\222\xxz: 00Oberkrainer\00Hintermhuehner
And of course, you could just pipe things.

C:\out\222>stringsnt.exe -n 9 x* | grep.exe 00

Code: Select all

C:\out\222\xxx: 00HinterHuhnstal
C:\out\222\xxx: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxy: 00HinterHuhnstal
C:\out\222\xxy: 00Oberkrainer\00Hintermhuehner
C:\out\222\xxz: 00HinterHuhnstal
C:\out\222\xxz: 00Oberkrainer\00Hintermhuehner
Post Reply