Aug 29

MyBot Tutorial Part 3

Here is the third part of the tutorial.

In this part of the tutorial I wont be giving code samples because the implementation differs for each game. What you will find here are tips that you could apply in your code.

  • User-Agent

The easiest and probably the most important prevention is changing your user-agent. In most browser games the moderators are able to see with which browser your are connecting to the game. When making a bot you have the advantage that you can control all the requests, including the user-agent that is send.
This doesn’t mean however that you can enter anything you want. If your bot has an user-agent like “My Bot v1.0” you know for sure you will get banned soon.You should instead use an user-agent of an existing browser like Firefox, IE or Chrome. The user-agent below is from FireFox.

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv: Gecko/20110803 Firefox/3.6.20

When the game moderators now look at your user-agent it will look like you’re playing the game in FireFox.

  • Randomizing

A bot can get detected if the interval between each action is always the same. For example checking a building queue every 20 minutes. They will still have to watch your account manually to detect this but there is a change they will detect your bot. To solve this you can randomize the interval. When you want to use an interval of 20 minutes you could for example use a value that is -10% or +10% of this interval.

  • Delays

Adding some delays can also be very useful. By increasing the delays between requests your bot will work better on slower connections. It will also make it less detectable because because when the bot is a bit slower it will act more like an human.

  • Reconnect

When your bot can reconnect to the server when the connection is lost you should make sure the reconnect timer isn’t to short. When there is for example a server maintenance and your bot tries to reconnect every 10-30 seconds you will get a lot of failed login attempts. This will most likely result in a ban.


If you have a question or a tip/suggestion feel free to share them in the comments.


2 pings

Skip to comment form

    • Alex on October 1, 2011 at 22:36
    • Reply

    You say “Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv: Gecko/20110803 Firefox/3.6.20” When the game moderators now look at your user-agent it will look like you’re playing the game in FireFox.

    I aks, Hoe can I arrange this for Chrome? Can you explain me please!

  1. If you go to with chrome you see what user-agent you need to use to simulate Chrome.

    • slim on November 20, 2011 at 20:34
    • Reply


    Can you give me a hint how to obtain the json parameter nlreq_id for Grepobot 2.0?
    Which request delivers the Value for this ID?

    Browsing the sourcecode of Grepobot2.0, i found out that you get this nlreq_id from 2 responses but their related requests also needs this id. How you obtain this value initially?

    Thanks for your great work

    1. You can use “0” as the initial value. When you play the game in your browser and watch the http requests just after you have logged in you will notice that the nlreq_id is also “0”.

    • Aurelio on January 19, 2012 at 22:59
    • Reply

    Thanks for sharing your “Bot Making” techniques with us!

    I used to make bots a way different: my bot would run a internet explorer frame, and manipulate fields, search forms, read HTML, etc.

    But your technique is better as it doesn’t need a browser.

    • justme on October 15, 2012 at 12:55
    • Reply

    hy Uthar.
    i want to ask you, about the scriipt or suce code, for planner attack in game ? can tell which is ? and we have the pissibility to put the script in ither site.
    My big aliance is working for a site, with domain is a really god job, and we wish to put this script or surce code on the site to organize detaill atack. its this possible ? do you can say ,or sent me the script.Or and ideea for start.

    1. No sorry I don’t have anything like that.

    • Ruben on February 5, 2013 at 20:45
    • Reply

    Hi Uthar.

    Great job for the bot

    I tried to compiler the source code of last version of grepobot 2 with Visual Studio Express 2012 for desktop but dosen’t work.

    This it the error:

    Warning 4 Could not find component ‘GrepUnits’ referred to GrepolisBot2
    Warning 4 Could not find component ‘GrepFarmers’ referred to GrepolisBot2
    Warning 4 Could not find component ‘GrepBuildings’ referred to GrepolisBot2

    can you help me?
    I wonder, which it your developed enviroment.

    PS: sorry for my english, it not good

    1. When you download the source code you’ll find a couple off dll’s called GrepUnits, GrepFarmers and GrepBuildings. If you add those as reference to your project you’ll be able to compile it.

      The development environment I use is Microsoft Visual Studio 2010.

        • Ruben on February 9, 2013 at 10:59
        • Reply

        Ah! Ok thank you. I can compiler the source code, but I thought that this code it the last version.

        can you give me the source code of the last version?


        1. No sorry. This the latest source code that is available for everyone. The current versions of the bot contain code that I want to keep private.

          But the available source code should give everyone enough ideas to make their own bots.

            • Ruben on February 9, 2013 at 23:12

            OK I understand. Soon I make a donation for the full version, but I wonder, if the file unlocked it’s valid for the future versions.

            And other question, in the folder of bot there is a folder called “captcha” with picture of captcha and I don’t know what the function.

            • Uthar on February 9, 2013 at 23:28

            Yes the unlock file will work for all future updates of this bot.
            The captcha folder is used to save all the captcha’s the bot has detected.

            • Ruben on February 10, 2013 at 16:02

            I thought those images are used to solve the captcha.
            If all the users write the solution in the image’s name and this it send to your server, you can make a data base with it.

            what do you think?

            • Uthar on February 10, 2013 at 23:18

            I have been thinking about that but it’s not going to work. Not only the numbers differ in captchas but also their location. Because the location is different everytime you have an almost infinite amount of possibilities.

            I could write my own algorithm to read every captcha but that would cost a lot of time and the service of 9kw is working fine at the moment.

    • Kostas on February 12, 2013 at 18:15
    • Reply

    Hi Uthar
    I just gave a glance to your guide ( I’m on my first steps in programming) but I think what people would like to see in your guides would be a guide on how to create a GUI for their bot so it would be more userfriendly.
    Thanks for your attention in advance and keep up the good work.(sorry for any grammatical issues or mispelling I’m form Greece and English isn’t my native language)

    1. This tutorial series is meant to teach the more technical details to create bots. While GUIs are interesting they don’t have anything to do with bots.

        • Kostas on February 12, 2013 at 22:47
        • Reply

        Ok you are the teacher here 🙂 Great work

    • Nick on August 3, 2014 at 02:16
    • Reply

    Uthar, I just read your tutorial, and I still have no idea, as to how to make a bot. Is there anything you can tell me that will help me learn how to understand your tutorial? Also, so you know, I do have experience in Web Design (HTML, CSS, and some Java Script), and have only, gone as far as, completing some of the tutorials on microsoft’s msdn page, when it comes to programing languages.

    1. I would suggest to first create some small useless programs just to get familiar with the language. There are many tutorials available online to improve your C# skills. After that try to request a single webpage (for example, this will help you understand the webrequests.

      • Nick on August 16, 2014 at 17:26
      • Reply

      OK cool

    • Buckyx on August 7, 2014 at 14:03
    • Reply

    how can I add add user-agent in http requests? I learned only adding content to POST requests which works fine

    also how do you analyze text you recieve on these requests? I need to make webbrowser with recieved HTML text and then analyze its elements, other way to do it?

    1. User-agent is called a header in http requests.

      To analyse the text I personally just search the String for the element id that contains the information I need. But if you want to analyse all the elements you could use some third party library. I assume there are some that can display your http response as a tree so that you can easily analyse all its elements.

    • WARLOCK72 on February 2, 2015 at 02:43
    • Reply

    I’m stuck with the bots I was making. I want to take the Captcha from a website upload and send to to have the captch completed but after spending a lot of time searching the net cant find anything to explain how I can do this in visual studion 2013. 🙁

    1. If you are using a browser element you can search for the html element containing the img and copy it to your clipboard.

  1. […] Part 3: Making your bot less detectable. […]

  2. […] Part 3: Making your bot less detectable. […]

Leave a Reply

Your email address will not be published.

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera