I need to scan a range of addresses in linux memory and compare its content in 4 bytes jump, I searched the web and didn't find a helpful implementation. the function I need to implement should be used in a module I'm trying to do. anyway, the signature of the function:
void scanMemory(int scan_range) {
// implementation here...
}
I need to scan the range between read func which I know and utsname (starting at utsname)
I found so far: C Pointers to scan memory which is using a for loop but not quite as I need.
Memory pattern scanning on Linux in C here I found the following:
for(i = 0; i < size; i++)
{
if(_compare((unsigned char *)(address + i), (unsigned char *)pattern, mask))
return (unsigned long)(address + i);
}
but I'm not sure the jumps is just 4 bytes.
I'm looking for ideas or implementation of the for
-loop i describe above