Sign in to follow this  
Followers 0
ElizabethGreene

So you want to build a Poker Bot?

4 posts in this topic

Hi!

I posted a blog entry about this that you might find really interesting.

Exposing the Dealer Text box on Pokerstars.

http://myserverstuff.blogspot.com/

Here is the content....

There are several threads in the forums from people trying to build a poker bot with varying degrees of success. Inevitably they get stuck trying to get input from the poker software. The dealer boxes have all of the information in an easily regular-expressioned pattern, but the control won't give up the text. You could OCR it, and that works ok, but there is a better way.

Pokerstars, is my particular favorite, so here goes.

First, let's try the easy approach. Fire up WinSpy++ or Winspector and browse around the Pokerstars window. The application really doesn't leak a lot of data in this approach. The Textbox of interest has a funny class name, AFX:4200:... That's about it. When we watch the messages in and out of the window there are just a bunch of WM_PAINT messages.

Interesting. All that window does is WM_PAINT, redrawing the window. That means it has to be a graphical window, a bitmap of text, that just _looks_ like a control. Very Very sneaky Mr. Stars, very sneaky.

Time for another Tool, PEView. PeView decodes the PE format of the binary, and reveals the libraries and Functions the application is importing. Scanning the list, it looks like pretty standard stuff. GDI32.dll, the kernel, User32... some others. Looking through the list, we only care about functions with "text" in the name. These are GDI32 and User32.

Now if only there was a way to override and trap every call to those libraries and dig around for our text. Following the aforementioned example, we'd want that to be a free tool, and available within the first page of google results. :) Enter WinAPIOverride http://jacquelin.potier.free.fr/winapioverride32/ Running the inspector we attach to Pokerstars and monitor the calls for GDI, the graphics library. In there we can see the application creating Display components, bitmaps, and generating those paint messages. Poo, no Dealer Text. Reloading and monitoring the User functions are much more interesting... There they are, the dealer messages are all created using the DrawText function.

So that is how pokerstars does it, they create a bitmap of what the textbox looks like off screen, and then show the bitmap. To get it out, all you have to do is write an API hook for the USER32 dll and IPC those messages over to your application. For a simple hook, Take a look at this article on codeproject. http://www.codeproject.com/KB/system/hooksys.aspx You have to change about 7 lines (6 for the functions and 1 to make it hook pokerstars) in it to expose all of the Pokerstars text where any application can reach it. Magic. :(

I wish I had a copy of Visual Studio. muttley

Good night all, Thanks for the Puzzle.

Elizabeth Greene

Share this post


Link to post
Share on other sites



Wrong.

That is not how they do it.


"I've seen your work in the past, and it's novice at best..." SmOke_N

Share this post


Link to post
Share on other sites

In Java you could create textboxes, so AutoIt and other programs languages doesn't see it just with the Window Info Tools..

Maybe what you tell it ones way to do it, but there is much faster ways.. and BTW I do believe that many has a proctection that is looking around in the system and see if some specific files is opened..

Regards

Share this post


Link to post
Share on other sites

Look here:

codingthewheel.com

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0