Added lua scripts and fixed a typo in state machine code

This commit is contained in:
Nick Cano
2016-06-06 22:36:51 -07:00
parent 50152ef2c9
commit aceb397307
6 changed files with 131 additions and 1 deletions
@@ -0,0 +1,36 @@
BASEADDRESS = getAddress("Game.exe")
function LocatePacketCreation(packetType)
for address = BASEADDRESS, (BASEADDRESS + 0x2ffffff) do
local push = readBytes(address, 1, false)
local type = readInteger(address + 1)
local call = readInteger(address + 5)
if (push == 0x68 and type == packetType and call == 0xE8) then
return address
end
end
return 0
end
FUNCTIONHEADER = { 0xCC, 0x55, 0x8B, 0xEC, 0x6A }
function LocateFunctionHead(checkAddress)
if (checkAddress == 0) then return 0 end
for address = checkAddress, (checkAddress - 0x1fff), -1 do
local match = true
local checkheader = readBytes(address, #FUNCTIONHEADER, true)
for i, v in ipairs(FUNCTIONHEADER) do
if (v ~= checkheader[i]) then
match = false
break
end
end
if (match) then return address + 1 end
end
return 0
end
local funcAddress = LocateFunctionHead(LocatePacketCreation(0x64))
if (funcAddress ~= 0) then
print(string.format("0x%x",funcAddress))
else
print("Not found!")
end
@@ -0,0 +1,25 @@
BASEADDRESS = getAddress("Game.exe")
function findString(str)
local len = string.len(str)
local chunkSize = 4096
local chunkStep = chunkSize - len
print("Found '" .. str .. "' at:")
for address = BASEADDRESS, (BASEADDRESS + 0x2ffffff), chunkStep do
local chunk = readBytes(address, chunkSize, true)
if (not chunk) then break end
for c = 0, chunkSize-len do
checkForString(address , chunk, c, str, len)
end
end
end
function checkForString(address, chunk, start, str, len)
for i = 1, len do
if (chunk[start+i] ~= string.byte(str, i)) then
return false
end
end
print(string.format("\t0x%x", address + start))
end
findString("hello")
findString("world")
@@ -0,0 +1,9 @@
function countLinkedListNodes(nodeAddress)
local counter = 0
local next = readInteger(nodeAddress)
while (next ~= nodeAddress) do
counter = counter + 1
next = readInteger(next)
end
return counter
end
+23
View File
@@ -0,0 +1,23 @@
function _verifyLinkedList(address)
local nextItem = readInteger(address) or 0
local previousItem = readInteger(address + 4) or 0
local nextItemBack = readInteger(nextItem + 4)
local previousItemForward = readInteger(previousItem)
return (address == nextItemBack
and address == previousItemForward)
end
function isValueInLinkedList(valueAddress)
for address = valueAddress - 8, valueAddress - 48, -4 do
if (_verifyLinkedList(address)) then
return address
end
end
return 0
end
local node = isValueInLinkedList(addressOfSomeValue)
if (node > 0) then
print(string.format("Value in LL, top of node at 0x0%x", node))
end
+37
View File
@@ -0,0 +1,37 @@
function _verifyMap(address)
local parentItem = readInteger(address + 4) or 0
local parentLeftItem = readInteger(parentItem + 0) or 0
local parentRightItem = readInteger(parentItem + 8) or 0
local validParent =
parentLeftItem == address
or parentRightItem == address
if (not validParent) then return false end
local tries = 0
local lastChecked = parentItem
local parentsParent = readInteger(parentItem + 4) or 0
while (readInteger(parentsParent + 4) ~= lastChecked and tries < 200) do
tries = tries + 1
lastChecked = parentsParent
parentsParent = readInteger(parentsParent + 4) or 0
end
return readInteger(parentsParent + 4) == lastChecked
end
function isValueInMap(valueAddress)
for address = valueAddress - 12, valueAddress - 52, -4 do
if (_verifyMap(address)) then
return address
end
end
return 0
end
local node = isValueInMap(addressOfSomeValue)
if (node > 0) then
print(string.format("Value in map, top of node at 0x0%x", node))
end