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 


[Help] Aob Scanner...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Oct 29, 2008 5:39 pm    Post subject: [Help] Aob Scanner... Reply with quote

I tryed to create a loop like this:
for i=&H00400000 to &H7FFFFFFF
next i

and echoed the results and it processes toooooooooooo slow... So I tryed it in delphi and it was even slower O.o So how do you scan for aobs?
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Wed Oct 29, 2008 6:16 pm    Post subject: Reply with quote

Are you honestly trying to do this in VB? Do it in C. Its a lot easier.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 26002
Location: The netherlands

PostPosted: Wed Oct 29, 2008 6:46 pm    Post subject: Reply with quote

do NOT output it to the screen. the display as slow as hell. Just keep it internal (And don't do any memory allocations during the scan, so no adding items to a dynamic list)
_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Wed Oct 29, 2008 7:21 pm    Post subject: Reply with quote

Just iterate through the range and add the ones you want to an array.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed Oct 29, 2008 7:28 pm    Post subject: Reply with quote

Dump all the pages of a process, create a collection of the readable ones, then read the regions each as separate blocks of memory, one RPM per region, then iterate through the bytes in local memory as your program requires.
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Thu Oct 30, 2008 5:07 pm    Post subject: Reply with quote

Use the KPM algorithm, that will speed up the search significantly.
(for longer patterns)

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Oct 30, 2008 5:15 pm    Post subject: Reply with quote

Dark Byte wrote:
do NOT output it to the screen. the display as slow as hell. Just keep it internal (And don't do any memory allocations during the scan, so no adding items to a dynamic list)


Wouldent that free up the screen because your app isn't processing messages?
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Sat Nov 01, 2008 9:25 pm    Post subject: Reply with quote

only output when you found something.. (and thats still risky because if you are looking for zeros.. there might be a million zeros in memory so you will find a million zeros aka 1 million outputs printed or added to list aka SLOW)

outputting every line from
0x00400000 to 0x7FFFFFFF would be slow in all languages.

thats 130,023,423 lines to print.

also in VB6 i assume you are using you could use the Step function

for i=&H00400000 to &H7FFFFFFF Step NUMBEROFBYTES
next i

it would skip X of NUMBEROFBYTES..

say you scan for DWORDS do Step 4.. it will skip by 4's of bytes aka DWORDS

skipping it by 4's would drop the output printing from 130 million to only 32 million lines lol.. but yah.. if you want to scan for like a memory string of 20 characters do Step 20 etc... it will be faster the higher the stepping is..

Also if you want to update a counter of how much it scanned do it like this

Code:


CounterBytesScanned = CounterBytesScaned + 1
If(ConterBytesScanned Mod 1000 = 0) Then
 Form1.SomeLabel.caption = CounterBytesScanned
End If



it would go up by 1000 everytime it passes a new 1000 number

now if you want it to go up by 1's you could still do that pretty fast if you keep calling DoEvents aka..

Code:

CounterBytesScanned = CounterBytesScaned + 1
Form1.SomeLabel.caption = CounterBytesScanned
DoEvents


But i wouldnt do that it will still slow down the scanning process if you keep calling useless code like that.. only call it when scanning is done.

but what I would do is make 2 loops.. 1 inside the other.. do a stepping of 65000 or something some BIG numbers and with the inside loop process the 65000..and Step the inside loop based on what you scan for dwords,words,byte or string of characters it would be faster by far..

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Nov 02, 2008 9:15 am    Post subject: Reply with quote

pkedpker wrote:
only output when you found something.. (and thats still risky because if you are looking for zeros.. there might be a million zeros in memory so you will find a million zeros aka 1 million outputs printed or added to list aka SLOW)

outputting every line from
0x00400000 to 0x7FFFFFFF would be slow in all languages.

thats 130,023,423 lines to print.

also in VB6 i assume you are using you could use the Step function

for i=&H00400000 to &H7FFFFFFF Step NUMBEROFBYTES
next i

it would skip X of NUMBEROFBYTES..

say you scan for DWORDS do Step 4.. it will skip by 4's of bytes aka DWORDS

skipping it by 4's would drop the output printing from 130 million to only 32 million lines lol.. but yah.. if you want to scan for like a memory string of 20 characters do Step 20 etc... it will be faster the higher the stepping is..

Also if you want to update a counter of how much it scanned do it like this

Code:


CounterBytesScanned = CounterBytesScaned + 1
If(ConterBytesScanned Mod 1000 = 0) Then
 Form1.SomeLabel.caption = CounterBytesScanned
End If



it would go up by 1000 everytime it passes a new 1000 number

now if you want it to go up by 1's you could still do that pretty fast if you keep calling DoEvents aka..

Code:

CounterBytesScanned = CounterBytesScaned + 1
Form1.SomeLabel.caption = CounterBytesScanned
DoEvents


But i wouldnt do that it will still slow down the scanning process if you keep calling useless code like that.. only call it when scanning is done.

but what I would do is make 2 loops.. 1 inside the other.. do a stepping of 65000 or something some BIG numbers and with the inside loop process the 65000..and Step the inside loop based on what you scan for dwords,words,byte or string of characters it would be faster by far..


WOW. Never thought of that. You can make it step so its 4x faster. Ill try that.
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sun Nov 02, 2008 11:26 pm    Post subject: Reply with quote

Step will miss values. If your data is not aligned on a 4 byte value from 0x00400000 you will skip the actual values. This will be especially bad for strings and byte arrays.

For most numeric values it should be safe to assume alignment, but with strings and byte arrays use KMP like I said - that will skip the most bytes you can possibly safely skip.

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 26002
Location: The netherlands

PostPosted: Mon Nov 03, 2008 7:38 am    Post subject: Reply with quote

also, if your cpu has sse4 you could make use of the new string scan instructions
_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Mon Nov 03, 2008 10:23 pm    Post subject: Reply with quote

nog_lorp wrote:
Step will miss values. If your data is not aligned on a 4 byte value from 0x00400000 you will skip the actual values. This will be especially bad for strings and byte arrays.

For most numeric values it should be safe to assume alignment, but with strings and byte arrays use KMP like I said - that will skip the most bytes you can possibly safely skip.


won't miss any values if you use it correctly. why would you skip 4 when you scanning for bytes for example.. but yah skipping a chunks of data in one loop and inside a inner loop processing that little chunk byte by byte will be faster.. I noticed loops work faster when they dont got too much to process.

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Tue Nov 04, 2008 12:30 am    Post subject: Reply with quote

It can miss value no matter how you use it, if the values are not aligned in memory to the boundary you are aligning to. For example, say you are scanning with Step 4:
0x00400000 = 01234567
0x00400004 = 89ABCDEF

The memory looks like this:
0x00400000:
[67 45 23 01][EF CD AB 89]

You just missed
0x00402002 = CDEF0123

Because you broke it up in the middle.

Also, KMP is much more complicated then you seem to think, read about it on Wikipedia.

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Wed Nov 05, 2008 9:09 pm    Post subject: Reply with quote

yah i think i know what u mean..

you mean like

[00 11 22 33][44 55 66 77 88]

and you scan for [11 22 33 44]

[00 [11 22 33 44] 55 66 77 88]




then it will not find it because it skipped the first 4.. because it started with 00.. that seems possible

a solution is still kinda possible with buffering the old data and processing it with new data but yah its not worth it.

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed Nov 05, 2008 10:47 pm    Post subject: Reply with quote

pkedpker wrote:
yah i think i know what u mean..

you mean like

[00 11 22 33][44 55 66 77 88]

and you scan for [11 22 33 44]

[00 [11 22 33 44] 55 66 77 88]




then it will not find it because it skipped the first 4.. because it started with 00.. that seems possible

a solution is still kinda possible with buffering the old data and processing it with new data but yah its not worth it.


Uhh...

Memory:

Code:

0x13371337: 00 11 22 33 44 55 66 77 88 99 00


Code:

for( byte *lpMem = 0x13371337; lpMem < (lpMem + length); lpMem++ ) {
    if( * (DWORD *)lpMem == 0x11223344 ) {
        printf( "Value found at address %d", (DWORD)lpMem );
    }
}


That does like this:

Code:

DWORD located at 0x13371337: 0x00112233
Does that value equal 0x11223344? No. Continue.

DWORD located at 0x13371337+1: 0x11223344
Does that value equal 0x11223344? Yes. Print

...


Of course, that's the naive way of searching for the data, but an implementation of KMP shouldn't be hard to create.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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