Solved Reading Array Elements - AOB Scan Function

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Hey Guys,

I have been trying to crack this for hours now, Ive been trying to create my own AOB Scan Function and well I am able to read the first byte and return the address but I dont know how to access the entire array to say if address bytes = DefinedByteArray, Ill show you my code and maybe you can help.

C++:
DWORD AOBscan(){
	
DWORD StartAddress = 0x6A21B25;
DWORD EndAddress = 0x6A21C4B; 
BYTE  Bytes[] = {0x71, 0x16}; 

for(StartAddress; StartAddress < EndAddress; StartAddress++){
	DWORD Res = mem.read<BYTE>(StartAddress);

	if(Res == Bytes[0]){
		cout << hex << StartAddress << endl;
		break;
	}


}
return StartAddress;
}
I am getting so close - i know i have to read the addresses one by one, and byte by byte and i need some sort of loop, i just cant think of how to code it.

I have tried many different lopping methods - i guess i need to go back to learning about arrays and just general C++ .

here is a different approach:

C++:
DWORD AOBscan(){
DWORD StartAddress = 0x11A4AF;
DWORD ReadLength = 0x19; // how many bytes to read from base
int bytePattern = 0;
BYTE PatternOfBytes[] = {0x89, 0xFF};

for(int i = 0; i != ReadLength; i++){

       if(mem.read<BYTE>((DWORD)StartAddress + i) == PatternOfBytes[bytePattern]) //if first byte matches array then
       {
         bytePattern++; //Increase the array number to read
       }

	   else if(bytePattern == PatternOfBytes[2]) //If the POB has reached it's end, return the address location
       { 
		   cout << hex << StartAddress + i << endl;
         return StartAddress + i;//Address location
       }

       else
       {
         bytePattern = 0; //The pattern was false so start from 0 and next address
       }
   }

}
dont worry about different address its just for debuging on solitaire atm, i will eventually have it so user can input start/end address and bytes to look for
 
Last edited:

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
Pattern scan i understand?
make a BYTE* pointer to this memory and check from 0 to sizeof(yourpattern) if all bytes match i guess, if not, startaddress++ till u reach the end
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
for(StartAddress; StartAddress < EndAddress; StartAddress++){
DWORD Res = mem.read<BYTE>(StartAddress);
You seem to be reading always at the same address (StartAddress).
 

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
You seem to be reading always at the same address (StartAddress).
......

StartAddress++

I can read every byte from StartAddress to EndAddress Perfectly but its one at a time - im trying the sizeof method provided, the only problem is reading it as an array so hopefully can solve later on, if not ill go back to learning about pointers and arrays
 

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
......

StartAddress++

I can read every byte from StartAddress to EndAddress Perfectly but its one at a time - im trying the sizeof method provided, the only problem is reading it as an array so hopefully can solve later on, if not ill go back to learning about pointers and arrays
C++:
   /* an array with 5 elements */
   double balance[5] = {1000.0, 2.0, 3.4, 17.0, 50.0};
   double *p;
   int i;

   p = balance; // p is a pointer to the first element of balance 0x6A21B25 in your case I guess
 
   /* output each array element's value */
   printf( "Array values using pointer\n");
   for ( i = 0; i < 5; i++ )
   {
       printf("*(p + %d) : %f\n",  i, *(p + i) ); // loop through the array
   }
So you could try to use the pointer of the first element and just loop the bytes if you know the size of the array. (end address - start address).
It is legal to use array names as constant pointers, and vice versa. Therefore, *(balance + 4) is a legitimate way of accessing the data at balance[4].
 
Last edited:

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
......

StartAddress++

I can read every byte from StartAddress to EndAddress Perfectly but its one at a time - im trying the sizeof method provided, the only problem is reading it as an array so hopefully can solve later on, if not ill go back to learning about pointers and arrays
I'm sorry I misread sth there.. Why's your pattern only 2 bytes btw?
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Don't know if this works but you could maybe try creating a buffer in your loop, with the length of your pattern, then just read X bytes (pattern length) and compare them with '=='
 

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Don't know if this works but you could maybe try creating a buffer in your loop, with the length of your pattern, then just read X bytes (pattern length) and compare them with '=='
I think i may have to make a buffer size.

Im able to read more than 1 byte now thanks to NTvalk.

Only problem with that is - say the address 0x11A4C2 - 0x89 / 0xFF

it will find it and return that address but also return 0x11A4C3 :p im getting really close now, i do apreciate the help you guys have provided
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
I think i may have to make a buffer size.

Im able to read more than 1 byte now thanks to NTvalk.

Only problem with that is - say the address 0x11A4C2 - 0x89 / 0xFF

it will find it and return that address but also return 0x11A4C3 :p im getting really close now, i do apreciate the help you guys have provided
Compare all those buffer bytes with the ones that you need, then it will give you 1 address only..
 

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Compare all those buffer bytes with the ones that you need, then it will give you 1 address only..
erm okay but that was pretty obvious...

the only compare functions i know is string compare so im guessing just convert them into char*/string and use strcmp(ResultBytes, MyByteArray).

C++:
DWORD AOBscan(){

DWORD StartAddress = 0x11A4AF;
DWORD EndAddress = 0x11A4C8;
DWORD bArray;

BYTE Bytes[] = {0x89, 0xFF};
BYTE *p;
p = Bytes;

int i;

for(StartAddress; StartAddress < EndAddress; StartAddress++){ //Counts from Start Address To End Address

  for ( i = 0; i < 2; i++ )   
	 { 
		bArray = (DWORD)p[i]; // Produces 89FF (Both My Bytes)
		if(mem.read<BYTE>(StartAddress) == bArray){ // Still Reads First Byte - I need String To Compare I Think
		cout << hex << StartAddress << endl; //Returns correct address but also the next address +1 (StartAddress++)
		}
	 }

}
  return 0;
}
So Far ^^ , im going to work on making it with char*/string so i can use strcmp but if anyone has a better idea please let me know :) - this was so much easier in VB hehe
 
Last edited:

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
erm okay but that was pretty obvious...

the only compare functions i know is string compare so im guessing just convert them into char*/string and use strcmp(ResultBytes, MyByteArray).

C++:
DWORD AOBscan(){

DWORD StartAddress = 0x11A4AF;
DWORD EndAddress = 0x11A4C8;
DWORD bArray;

BYTE Bytes[] = {0x89, 0xFF};
BYTE *p;
p = Bytes;

int i;

for(StartAddress; StartAddress < EndAddress; StartAddress++){

  for ( i = 0; i < 2; i++ )   
	 { 
		bArray = (DWORD)p[i];
		if(mem.read<BYTE>(StartAddress) == bArray){
		cout << hex << StartAddress << endl;
		}
	 }

}
  return 0;
}
So Far ^^ , im going to work on making it with char*/string so i can use strcmp but if anyone has a better idea please let me know :) - this was so much easier in VB hehe
a char* is just a pointer to a byte (msdn : typedef BYTE char), so yeah you should use a char buffer, but I don't think strcmp will work out good for you because a char array is not a string, a char array with a \0 (?) at the end is a string. You could try to make this a string and use strcmp but you can also just use == for each byte in a loop.
PS: idk exactly how strcmp works, it could be it works with just char arrays, Goodluck.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods