panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Sat Apr 15, 2017 6:40 pm Post subject: |
|
|
May be some helper function to convert a hex to some aob string, so that it can be search using AOBScan. eg.
Code: |
function s2aob(s) -- s is an arbitrary byte string
return s:gsub(".",function(c)
return string.format(" %02X", c:byte())
end):sub(2)
end
-- ntype = 2,4,8 for word, dword, qword, 'd' for double (8bytes), 'f' for float (4bytes)
function num2ByteString(n, ntype, isBigEndian)
local packfmt = tonumber(tostring(ntype)) and 'i'..ntype or ntype or 'i4'
packfmt = (isBigEndian and '>' or '<')..packfmt
return string.pack(packfmt,n)
end
function str2Wide(s)
return byteTableToString(wideStringToByteTable(s))
end
|
So to AOBScan a (hex, prefix with 0x) number, try
Code: |
local aob = AOBScan ( s2aob(num2ByteString( 0x12345 )) ) -- 4byte dword
--> AOBScan ( "45 23 01 00" )
local aob = AOBScan ( s2aob(num2ByteString( 0x12345 , 8)) ) -- 8byte qword
--> AOBScan ( "45 23 01 00 00 00 00 00" )
|
To AOBScan a double, try
Code: |
local aob = AOBScan ( s2aob(num2ByteString( 43.5, 'd', true )) ) -- big endian
--> AOBScan ( "40 45 C0 00 00 00 00 00" )
local aob = AOBScan ( s2aob(num2ByteString( 43.5, 'd')) ) -- little endian
--> AOBScan ( "00 00 00 00 00 C0 45 40" )
|
To scan for a string ,
Code: |
local aob = AOBScan ( s2aob("Cheat") ) -- ascii string
--> AOBScan ( "43 68 65 61 74" )
local aob = AOBScan ( s2aob(str2Wide("Cheat")) ) -- unicode string
--> AOBScan ( "43 00 68 00 65 00 61 00 74 00" )
|
It can also combine/join multiple aob like a structure using table.concat,
Code: |
local aob = AOBScan ( table.concat ( { s2aob(num2ByteString(5)), s2aob("Cheat")}, " ") )
--> AOBScan ( "05 00 00 00 43 68 65 61 74" )
|
or using MemScan Class, it has many option that may map to the CE scan interface.
For both scan method, you may need to consider what to do if the scan is not unique, there may be risk on modifying false result.
_________________
- Retarded. |
|