Jump to content
  • 0

need help write a script to find values


zolotov123344

Question

Posted

the script should do a search in LibUnity (code app) and check each qword value so that the first digit is 4, and the last three digits are 056, the number of digits in qword values are different.

3 answers to this question

Recommended Posts

Posted

Only positive numbers or negative as well? In first case little optimization can be applied to initial search by searching for "4056~4999999999999999056", because there are no positive 64-bit integers that meet the criteria outside of that range.

Posted
4 hours ago, CmP said:

Только положительные числа или тоже отрицательные? В первом случае небольшая оптимизация может быть применена к начальному поиску путем поиска «4056 ~ 4999999999999999056», потому что нет положительных 64-битных целых чисел, соответствующих критериям за пределами этого диапазона.

both positive and negative

Posted

The following code should do what you described, but I haven't tested it. There is also quite some room for optimizations in case it's execution takes too much time.

gg.setRanges(gg.REGION_CODE_APP)
gg.clearResults()
gg.searchNumber("-4055~~4055", gg.TYPE_QWORD)
gg.refineNumber("-4999999999999999056~4999999999999999056", gg.TYPE_QWORD) -- minor optimization to exclude some of the values that don't meet the criteria
local targetValues = {}
local valuesCounter = 1
while gg.getResultsCount() > 0 do
  local checkedResults = gg.getResults(100000) -- processing up to 100k results per iteration
  for i, v in ipairs(checkedResults) do
    local value = v.value
    if value < 0 then
      value = -value
    end
    local str = tostring(value)
    if (str:sub(1, 1) == "4") and (str:sub(-3, -1) == "056") then
      targetValues[valuesCounter] = {address = v.address, flags = v.flags}
      valuesCounter = valuesCounter + 1
    end
  end
  gg.removeResults(checkedResults)
  checkedResults = nil -- to allow the table to be garbage collected according to https://gameguardian.net/help/lua_details.html
end
gg.loadResults(targetValues)

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.