Jump to content
  • 0

Can dump file name be changed?


LIFE123

Question

Hello!

So, I have a simple question as the title says.

I want to be able to read the binary dump file after dumping with io.open() then print some strings that I will match with a specific pattern.

 

The problem is that the file name must be known and as you know, game guardian dump files have different name packagename-address-address.bin

 

The dump file name can be different each time I do a dump... how to change it to specific name always?

Is it even possible with gameguardian?

 

Also, I tried os.rename("/sdcard/dump/*.bin","/sdcard/dump/xx.bin") to change the file name but the * doesn't work .. it needs the exact file name..

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

You will need to loop through the gg.getRangesList() table.

check each if starting address is higher than "start" and lower than "end" if it is use that "start" as the first address in the filename

then check your ending address the same way and use that  "end" and the second address in your filename

Link to comment
Share on other sites

On 4/3/2022 at 1:32 AM, BadCase said:

You will need to loop through the gg.getRangesList() table.

check each if starting address is higher than "start" and lower than "end" if it is use that "start" as the first address in the filename

then check your ending address the same way and use that  "end" and the second address in your filename

Got any code example for this?

 

I'm new to these things and I don't quite know how to excute it.

Link to comment
Share on other sites

6 hours ago, LIFE123 said:

Got any code example for this?

 

I'm new to these things and I don't quite know how to excute it.

function dumpAndRename(startAddress, endAddress,  newName, keepPackageName, keepAddresses, savePath)
    if savePath == nil then
        savePath = gg.EXT_STORAGE .. "/Download/"
    end
    local nameStart
    local nameEnd
    for i, v in pairs(gg.getRangesList()) do
        if v["start"] < startAddress and v["end"] > startAddress and nameStart == nil then
            nameStart = v["start"]
        end
        if v["start"] < endAddress and v["end"] > endAddress and nameEnd == nil then
            nameEnd = v["end"]
        end
        if nameStart ~= nil and nameEnd ~= nil then
            break
        end
    end
    gg.dumpMemory(startAddress, endAddress, savePath, gg.DUMP_SKIP_SYSTEM_LIBS)
    local constructedFileName = savePath
    if keepPackageName == true then
        constructedFileName = constructedFileName .. gg.getTargetPackage() .. "-"
    end
    constructedFileName = constructedFileName .. newName
    if keepAddresses == true then
        constructedFileName = constructedFileName .."-" .. string.format("%x", nameStart) .. "-" .. string.format("%x", nameEnd)
    end
    constructedFileName = constructedFileName .. ".bin"
    os.rename(savePath .. gg.getTargetPackage() .."-" .. string.format("%x", nameStart) .. "-" .. string.format("%x", nameEnd) .. ".bin", constructedFileName)
    return constructedFileName
end

Use Examples

dumpAndRename(0xC7457004, 0xC7457008, "My New Name")
Result: /storage/emulated/0/Download/My New Name.bin

dumpAndRename(0xC7457004, 0xC7457008, "My New Name",true)
Result: /storage/emulated/0/Download/com.autoclicker.clicker-My New Name.bin

dumpAndRename(0xC7457004, 0xC7457008, "My New Name",true,true)
Result: /storage/emulated/0/Download/com.autoclicker.clicker-My New Name-c7457000-c7593000.bin

dumpAndRename(0xC7457004, 0xC7457008, "My New Name",false,true)
Result: /storage/emulated/0/Download/My New Name-c7457000-c7593000.bin

dumpAndRename(0xC7457004, 0xC7457008, "My New Name",true,false)
Result: /storage/emulated/0/Download/com.autoclicker.clicker-My New Name.bin

dumpAndRename(0xC7457004, 0xC7457008,  "My New Name", true, true, gg.EXT_STORAGE .. "/Download/Test Dump/")
Result: /storage/emulated/0/Download/Test Dump/com.autoclicker.clicker-My New Name-c7457000-c7593000.bin

Link to comment
Share on other sites

When you dump with GG it dumps from the beginning of the range that the first address is in to the end of the range that the second address is in. Get those ranges and form your filename using the ['start'] and ['end'] of those 2 ranges

Link to comment
Share on other sites

I get the idea but I don't know how to excute it.

 

How to get the start and ending addresses of the dump.

Maybe something like this? but the start and ending are not like the name of dump file.

resultCounts = gg.getResultsCount()

results = gg.getResults(resultCounts)

start = results[1].address

ending = results[5].address



filename = ("com.packagename-"..start.."-"..ending..".bin")



gg.dumpMemory(start , ending, "/sdcard/dump/", gg.DUMP_SKIP_SYSTEM_LIBS)



f = io.open("/sdcard/dump/"..filename, "r")

content = f:read("*all")



-- do some operations



f:close()

 

I also tried this but doesn't seem to work:

 

t = gg.getRangesList();

start = t[1].start

ending = t[5]['end']

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.