Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Outputting AOB scan result (with pattern)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jan 29, 2017 8:50 am    Post subject: Outputting AOB scan result (with pattern) Reply with quote

Hi,

Code:
aobresult=AOBScan("24 01 62 07")
i = 0
if (aobresult~=nil) then
  print("Results found: "..aobresult.Count)
  while i<aobresult.Count do
     print("result = "..aobresult[i])
     i=i+1
  end
  aobresult.destroy()
  aobresult=nil
else
  print("No results found")
end

--- Will print results :
Results found: 127
result = 10AE4403
result = 10AECDD6
//... until 127th addresses



Now, how to ouputting aob scan results :

aobrpattern = AOBScan("24 01 62 07 ?? ?? ?? ??")
and output result e.q :
-- result 1 : 24 01 62 07 66 E1 FF 01
-- result 2 : 24 01 62 07 D1 D2 47 48
and so on...

or

aobpattern = AOBScan("24 01 62 07")
and output results automatic adding 4 bytes or more behind every matched aob pattern given scan results found, = 24 01 62 07 xx xx xx xx, which xx xx xx xx is followed bytes match to the aob pattern.

I've tried Panraven function :

Code:
function multiAOBPatch(from,to,protect)
 local good,aob = 0,AOBScan(from,protect)
 if (aob == nil) then
  showMessage("AOB not found..")
  beep()
  return
 else
  if messageDialog("Do you want replace all AOB results found ?", mtWarning, mtConfirmation, mbYes) ==mrYes then
   for i=0,aob.Count-1 do
    print(aob[i])
    if autoAssemble(aob[i]..":\ndb "..to)then good=good+1 end
   end
    showMessage("AOB Found and replaced")
    beep()
    aob.Destroy()
   end
  return good
 end
   showMessage("AOB's found has NO replace")
   aob.Destroy()
   return
end


from = "24 01 62 07 ?? ?? ?? ??"
to = ""
multiAOBPatch(from,to,"+W*X-C")

-- result : 24 01 62 07 ?? ?? ?? ??   ---> ?? ?? ?? ?? not show bytes (hex) contains


Thanks
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jan 29, 2017 9:01 am    Post subject: Reply with quote

Code:
function getByteString(address, bytecount)
  local bytes = readBytes(address, bytecount, true)
  if bytes then
    local result = ""
    for i = 1, #bytes do
      if #result > 0 then
        result = result .. " "
      end
      result = result .. string.format("%02X", bytes[i])
    end
    return result
  end
end

print(getByteString(0x7FFCA9A914C0, 6) or "not found")
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jan 29, 2017 9:46 am    Post subject: Reply with quote

Thanks Zanzer sir,

Done and work properly,

Code:
function getByteString(address, bytecount)
  local bytes = readBytes(address, bytecount, true)
  if bytes then
    local result = ""
    for i = 1, #bytes do
      if #result > 0 then
        result = result .. " "
      end
      result = result .. string.format("%02X", bytes[i])
    end
    return result
  end
end


aobresult=AOBScan("24 01 62 07")
j = 0
cnt = 1
if (aobresult~=nil) then
  print("Results found: "..aobresult.Count)
  while j < aobresult.Count do
    a = getByteString(aobresult[j], 12)
    print("Address "..cnt.." = "..aobresult[j].." --> AOB :  "..a)
     j=j+1
     cnt = cnt+1
  end
  aobresult.destroy()
  aobresult=nil
else
  print("No results found")
end

--- result : [[
Results found: 127
Address 1 = 108E4403 --> AOB :  24 01 62 07 12 09 00 00 24 10 C5 C4
Address 2 = 108ECDD6 --> AOB :  24 01 62 07 11 0C 00 00 C4 24 29 C7
Address 3 = 108ED417 --> AOB :  24 01 62 07 12 05 00 00 C0 24 76 C6
Address 4 = 108ED52A --> AOB :  24 01 62 07 12 0D 00 00 C1 24 64 C6
//
// and so on...
]]




regards
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites