Thursday, November 8, 2012

How to simulate mouse and keyboard ?

SendInput

The easiest way to do it is to use SendInput function.
here is a link explaining how to do it, and, trust me, it does work

Be aware that you can be detected as using a bot, that why you should use this function only if you are playing on site where botting is not forbidden

The problem is the poker software can use GetAsyncKeyState function to check if the button was pressed, and unfortunately SendInput cannot trick this function. Maybe there is a workaround to clear this key state ? I don't know, but as long as you are using this kind of api, your program won't behave the same way as human does, and you will still have risk to be detected

OpenHoldem or WinHoldem platform are using bring.exe program which is a close source software, so I don't know how it works, but I suppose that it's using SendInput function. I would not try to use bring.exe with pokerstars without knowing what he is doing.

Create a fake mouse and keyboard driver

This is a good solution if you are using a real computer (not a virtual machine). There is no way to find if a button was pressed by the your bot or by a human, well ... it's not completely true.
The application may check the driver and check build date, checksum. (is it possible that a player have a unknown mouse driver ?)

Create a fake usb mouse and keyboard

I'm not talking about creating your own driver as I does previously, but I'm talking about using usb  communication to simulate a standard usb mouse or a standard usb keyboard.
Note:
If you are going this way, note that you can buy a dvi to usb (or vga to usb) adapator. So you will be able to analyse your picture without to have any running application on the computer where you run the poker client.

use vmware or virtualbox api/sdk

If you are using a virtual machine then you should try to use theses solutions as there is no way for the poker client to know if a button is pressed by your hardware or by the virtual machine api
For virtualbox, you can use putMouseEventAbsolute for mouse simulation and putScancode for keyboard simulation

Warning:

Whatever the chosen solution, you may want to move your mouse and click like human:
- don't click the same pixel, even if the center of the button have more chance to be cicked than pixel in border of the button. (openholdem is using a Gaussian equation)
-  maybe the mouse moement should be as human as possible. (no teleportation, don't follow a mathematical straight line
 - wait some random time before 2 pressed buttons
- etc ...


5 comments:

  1. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles.Keep up the good work! http://roulette-gamedownload

    ReplyDelete
  2. Unlike the spambot above me, I really did enjoy your article. Unfortunately VMware doesn't seem to have equivalent keyboard/mouse input.

    ReplyDelete
  3. This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. Login Loren Poker

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! situs poker qq

    ReplyDelete