Anti-Bot system

DeletedUser

Guest
I am new, so forgive me if there exist post similar to this.

One day after starting playing grepolis, I wrote simple farming bot for windows. I suggest to make little anti-bot system.

For request level, I suggest uniqe keys randomized for one demand-click.

For interface level, I suggest to display farming options randomly shuffled.

To understand how to protect interface, try to analize my bot :

Code:
#include <iostream>

#include <windows.h>



using namespace std;

int main()

{

    POINT v[9], demand, quit;

    int x;

    cout << "Grepolis v 0.3 by Scony\n"

    << "9x village available\n"

    << "-----------------------\n"

    << "1..9 - when cursor on village 1..9\n"

    << "Z - when cursor on demand label\n"

    << "X - when cursor on quit window button\n"

    << "Left CTRL - Start bot\n"

    << "Right CTRL - Finish bot\n"

    << "-----------------------\n\n"

    << "Type in village ammount (1..9) : ";

    cin >> x;

    cout << endl;

    bool flag = false;

    while(1)

    {

      if(GetAsyncKeyState((int)'1'))

      {

        GetCursorPos(&v[0]);

        cout << "V[1]: " << v[0].x << ";" << v[0].y << endl;

      }

      if(GetAsyncKeyState((int)'2'))

      {

        GetCursorPos(&v[1]);

        cout << "V[2]: " << v[1].x << ";" << v[1].y << endl;

      }

      if(GetAsyncKeyState((int)'3'))

      {

        GetCursorPos(&v[2]);

        cout << "V[3]: " << v[2].x << ";" << v[2].y << endl;

      }

      if(GetAsyncKeyState((int)'4'))

      {

        GetCursorPos(&v[3]);

        cout << "V[4]: " << v[3].x << ";" << v[3].y << endl;

      }

      if(GetAsyncKeyState((int)'5'))

      {

        GetCursorPos(&v[4]);

        cout << "V[5]: " << v[4].x << ";" << v[4].y << endl;

      }

      if(GetAsyncKeyState((int)'6'))

      {

        GetCursorPos(&v[5]);

        cout << "V[6]: " << v[5].x << ";" << v[5].y << endl;

      }

      if(GetAsyncKeyState((int)'7'))

      {

        GetCursorPos(&v[6]);

        cout << "V[7]: " << v[6].x << ";" << v[6].y << endl;

      }

      if(GetAsyncKeyState((int)'8'))

      {

        GetCursorPos(&v[7]);

        cout << "V[8]: " << v[7].x << ";" << v[7].y << endl;

      }

      if(GetAsyncKeyState((int)'9'))

      {

        GetCursorPos(&v[8]);

        cout << "V[9]: " << v[8].x << ";" << v[8].y << endl;

      }

      if(GetAsyncKeyState((int)'Z'))

      {

        GetCursorPos(&demand);

        cout << "demand: " << demand.x << ";" << demand.y << endl;

      }

      if(GetAsyncKeyState((int)'X'))

      {

        GetCursorPos(&quit);

        cout << "quit: " << quit.x << ";" << quit.y << endl;

      }

      if(GetAsyncKeyState(VK_LCONTROL))

      {

        flag = true;

      }

      if(GetAsyncKeyState(VK_RCONTROL))

      {

        flag = false;

      }

      if(flag)

      {

        for(int i = 0; i < x; i++)

        {

          cout << "V[" << i << "]...\n";

          SetCursorPos(v[i].x,v[i].y);

          Sleep(1000);

          mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);

          mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);

          Sleep(1000);

          mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);

          mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);

          SetCursorPos(demand.x,demand.y);

          Sleep(3000);

          mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);

          mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);

          SetCursorPos(quit.x,quit.y);

          Sleep(1000);

          mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);

          mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);

        }

        cout << "Sleeping 5 mins + rand (0..9s)...\n";

        Sleep(300000+(rand()%10)*1000);

      }

      Sleep(1);

    }

}
 
Top