QuickBMS to dump hex values, or hashes

Doubts, help and support about QuickBMS and other game research tools
cyberspeed
Posts: 104
Joined: Wed Mar 23, 2016 5:11 am

QuickBMS to dump hex values, or hashes

Post by cyberspeed »

Is it possible to use quickbms to have a script that can scan multiple files and dump 16bytes long hashes/hex values and save them to a txt file?
Lets say I have multiple samples as example below where starting offset is 20, from where I want the hash to begin and end in 16bytes long to be saved each hash string in one line.
Image
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS to dump hex values, or hashes

Post by aluigi »

It's a bit more complicated that what it looks like and it depends by how do you want to store the hash in the output file, I mean the format (probably just a sequence of 00112233...ff)
cyberspeed
Posts: 104
Joined: Wed Mar 23, 2016 5:11 am

Re: QuickBMS to dump hex values, or hashes

Post by cyberspeed »

Oh I didn't know it could be complicated, all I wanted was what you see highlighted to be saved as it is.
The search function would reach offset 0x20 in this sample above, obviously I would have to change offsets depending on input or the byte length I want to be saved.
And starting that offset to save 16 bytes as are seen, no special formatting, spaces or other fancy output:

Code: Select all

32F61FB3097C71DA784036D129061CC7
next file hash
next file hash
etc

Then it would scan next file and save the hash in another line, so on and so forth.
But based on your sequence example its same thing, right?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS to dump hex values, or hashes

Post by aluigi »

So you can just use this simple script:

Code: Select all

goto 0x20
set HASH string ""
for x = 0 < 16
    get TMP byte
    string TMP p "%02X" TMP
    string HASH + TMP
next x
print "%HASH%"

quickbms.exe script.bms folder > list.txt
cyberspeed
Posts: 104
Joined: Wed Mar 23, 2016 5:11 am

Re: QuickBMS to dump hex values, or hashes

Post by cyberspeed »

Thank you so much, it works great.
And if I need in a file to save between 3 up to 7 hashes, is this correct, or theres a better way?

Code: Select all

goto 0x110
set HASH string ""
for x = 0 < 16
    get TMP byte
    string TMP p "%02X" TMP
    string HASH + TMP
next x
print "%HASH%"

goto 0x1C0
set HASH string ""
for x = 0 < 16
    get TMP byte
    string TMP p "%02X" TMP
    string HASH + TMP
next x
print "%HASH%"

goto 0x270
set HASH string ""
for x = 0 < 16
    get TMP byte
    string TMP p "%02X" TMP
    string HASH + TMP
next x
print "%HASH%"
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS to dump hex values, or hashes

Post by aluigi »

Code: Select all

callfunction DUMP 1 0x110
callfunction DUMP 1 0x1C0
callfunction DUMP 1 0x270

startfunction DUMP
    goto DUMP_ARG1
    set HASH string ""
    for x = 0 < 16
        get TMP byte
        string TMP p "%02X" TMP
        string HASH + TMP
    next x
    print "%HASH%"
endfunction
The arguments of the functions is a very nice feature that probably nobody uses... even me! :D
cyberspeed
Posts: 104
Joined: Wed Mar 23, 2016 5:11 am

Re: QuickBMS to dump hex values, or hashes

Post by cyberspeed »

Thank you, definitely a cleaner way of doing it.