DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Thu Aug 07, 2014 3:45 pm Post subject: AOBScan.. filter by bytes |
|
|
Saw few minutes ago a thread with request of how to filter the AoB based on bytes on specific location...
Anyhow here's the script to achieve so.. feel free to modify it.
added some info at th e bottom of the script.
Code: | function excludeAoBScan(AoB, replaceAoB, excludeBytes)
local exclude_array;
if(type(excludeBytes) == 'string') then
exclude_array = {};
local no_space_bytes = string.gsub(excludeBytes, "%s", "");
for i=1,#no_space_bytes, 2 do
local value = string.sub(no_space_bytes,i,i+1)
exclude_array[#exclude_array+1] = tonumber((value == '??' and '' or '0x') .. value) or false;
end
end
if (not exclude_array) then
return showMessage('Not a valid table');
elseif (not AoB) then
return showMessage('No AoB was given');
elseif (not replaceAoB) then
return showMessage('No replace AoB was given');
end
local byteCount = #string.gsub(AoB, "%s", "")/2;
local AoB_object = AOBScan(AoB);
if (AoB_object) then
local count_replace = 0;
for i = 0, AoB_object.Count - 1 do
local address = AoB_object.getString(i);
local addressData = readBytes(address, byteCount,true);
if (addressData) then
local include = false;
for index,byte in pairs(addressData) do
if (byte ~= exclude_array[index] and exclude_array[index]) then
include = true;
end
end
if (include) then
local activate = '';
for i = 1, string.len(replaceAoB), 3 do
local z = string.sub(replaceAoB, i, i+2);
local x, y = string.find(z, "%?+");
if (x == nil) then
activate = activate .. address .. "+" .. (string.format("%x",(i-1)/3)) .. ':\ndb ' .. z .. '\n';
end
end
if(autoAssemble(activate)) then
count_replace = count_replace + 1;
end
end
end
end
if (count_replace and count_replace > 0) then
showMessage("Replaced " .. count_replace .. " entries successfully!");
end
AoB_object.destroy();
end
end
--[[
Usage:
excludeAoBScan(Search,Replace,Exclude)
-- Search = The aob you seek to find (supports wild cards)
-- Replace = The aob you want to replace with the result (supports wild cards)
-- Exclude = The aob you want to ignore (checking byte by byte ignoring wild cards) (supports wild cards)
Examples
-- excludeAoBScan("11 34 ?? ?? 00 00 00 ??","10 34 ?? ?? 00 00 00 ??","11 34 7d ?? 00")
-- seraching for "11 34 ?? ?? 00 00 00 ??" (finds 4 entries);
-- read the entries data (checking byte by byte with "11 34 7d ?? 00") and filtering what address can be activated (3 out of 4 can be enabled)
-- replacing all entires that can be replaced with "10 34 ?? ?? 00 00 00 ??";
Notes:
You cannot compare bytes that aren't are beyond the search aob length.
The script does not check byte by byte (like 1 wildcard and 1 number)
--]] |
_________________
|
|