Announcement

Collapse
No announcement yet.

Python bot for bypass Battleye (Windows, osx, linux)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python bot for bypass Battleye (Windows, osx, linux)

    Hello guys, today i see one library in python with name OpenCV, this is a IA for recongite images on screen/webcam and more..
    I think this is a good way to resolve problem with battleye service, because with python you can migrate a linux/osx app easy and when u debbug your code this generate another process name. here is my code, he's detect a item from png image (the item is cropped without borders and 15x15) and find cordinates in screen in x milisecond.
    Code:
    import time
    import pyautogui
    import cv2
    import numpy as np
    from  PIL import ImageGrab
    
    #simple bot for detect Tibia item image on screen without inject in client
    #You need only crop the image of item in 15x15 (for work)
    #note i develope this for works on 1360x768 resolution if you need another change the bbox on ImageGrab().grab
    #for completly use u need adapt this with win32gui (for get window rect/position)
    #Thanks a lot.
    #_JMG/Sleepy22
    
    def imagesearch(image, precision=0.8):
        im = ImageGrab.grab()
        img_rgb = np.array(im)
        img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
        w,h  = image.shape[::-1]
    
        res = cv2.matchTemplate(img_gray, image, cv2.TM_CCOEFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        if max_val < precision:
            return [-1,-1]
        return max_loc
    
    def imageinrange(image,precision,type):
            if type == "ground":
                im = ImageGrab.grab(bbox=(288, 85, 897, 529))
                img_rgb = np.array(im)
                img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
                w, h = image.shape[::-1]
    
                res = cv2.matchTemplate(img_gray, image, cv2.TM_CCOEFF_NORMED)
                min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
                if max_val < precision:
                    return [-1, -1]
                return max_loc[0]+288, max_loc[1]+85
            else:
                im = ImageGrab.grab(bbox=(1188, 40, 1360, 726))
                img_rgb = np.array(im)
                img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
                w, h = image.shape[::-1]
    
                res = cv2.matchTemplate(img_gray, image, cv2.TM_CCOEFF_NORMED)
                min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
                if max_val < precision:
                    return [-1, -1]
                return max_loc[0]+1188,max_loc[1]+40
    
    def getground(image):
        template = cv2.imread(image, 0)
        template = cv2.resize(template, dsize=(19, 19), interpolation=cv2.INTER_CUBIC)
        tp = imageinrange(template,0.8,'ground')
        return tp
    
    def getinventory(image):
        template = cv2.imread(image, 0)
        template = cv2.resize(template, dsize=(15, 15), interpolation=cv2.INTER_CUBIC)
        tp = imageinrange(template, 0.8,'inventory')
        return tp
    
    def getall(image):
        tp = getground(image)
        if tp == [-1,-1]:
            tp = getinventory(image)
        return tp
    
    
    time.sleep(3)
    p = getall("teste.png")
    pyautogui.moveTo(p[0],p[1])
    this is the teste.png for codes work, note read the firsts lines on code.
    teste.png

  • #2
    Hey,

    Nice idea! I don't know how Battle Eye Service working. Could you explain it a little bit?
    I guess that they spying computer for unexpected *exe using kernel32.dll etc?

    Comment


    • #3
      The Battle eye Works with 3 methods, First analising If any software read/write in memory of Tibia client, Second analising If the network packages is changeds, and last with blacklist software. If you relase a public client of your bot, i think in 2/3 days your bot is added on blacklist. But with python have 3 ways to Works. First generate a New exe for each time running, second run under Linux, last run under osx.

      Comment


      • #4
        So good sleepy22 i did a simplel healer with pyautogui, PIL, win32gui and i didnt banned yet

        Comment


        • #5
          Share with us!

          Comment


          • #6
            Yes sure, i shared on github

            https://github.com/raphlmiranda/Tibia-Simple-Healers

            Comment


            • #7
              Very nice, i see your project, thats good!

              Comment


              • #8
                you can use python to generate image with background gui client and tibia font, for generate automatic names for battle. with this you can make a good battlelist, friendlist, sio and more.

                Comment


                • #9
                  code example:
                  from PIL import Image, ImageDraw, ImageFont

                  img = Image.new('RGB', (100, 30), color = (73, 109, 137))

                  fnt = ImageFont.truetype('/Library/Fonts/Arial.ttf', 15)
                  d = ImageDraw.Draw(img)
                  d.text((10,10), "Hello world", font=fnt, fill=(255, 255, 0))

                  img.save('pil_text_font.png')

                  Comment


                  • #10
                    Thank you Sleepy, i'll use this. Now i'm using tesseract to get the int life.
                    Last edited by grl4ever; 04-11-2018, 12:13 AM.

                    Comment


                    • #11
                      Originally posted by sleepy22 View Post
                      The Battle eye Works with 3 methods, First analising If any software read/write in memory of Tibia client, Second analising If the network packages is changeds, and last with blacklist software. If you relase a public client of your bot, i think in 2/3 days your bot is added on blacklist. But with python have 3 ways to Works. First generate a New exe for each time running, second run under Linux, last run under osx.
                      I don't think you quite understand how the "software blacklist" works. It's not simply a case of generating a new binary file. They use a system of binary fingerprinting, and in theory they could take any segment of memory they know to be specific to a given application. In the case of Python, if you're using something like Py2Exe you're embedding the whole Python framework and all packages/eggs into a single file. This is treated as an executable by the Windows PE loader. On top of that, the script itself is loaded from its pyc format. The problem is, they can simply take 10 "lines of code worth" of bytecodes from that pyc file, use them as the fingerprint. If they find those matching bytecodes on a running system, they can assume that the bot is running there.

                      Aside from that, there is no BattlEye on Linux or Mac OS as far as client-manipulation bots are concerned. You could, in theory, inject an SO file (Linux DLL equivalent), or read memory like the olden days without being cock-blocked by BE. Beyond that, there is no restriction except in releasing binaries to the public. If you wanted a private bot, Linux would be the perfect place to start, and tools such as process_vm_readv would be worth investigating. Combine those with a Python keyboard emulator of some kind, and you've got all you need to replicate something as powerful as WindBot.

                      Comment


                      • #12
                        In this case, you can make a server that will generate the source code and then send it to users so that the battle eye may have problems with reading this if the functions will be arranged differently each time. It is best to run the bot before turning on the Tibia client to prevent the binary code from being saved before downloading the source.

                        Comment


                        • #13
                          Originally posted by Ascer View Post
                          In this case, you can make a server that will generate the source code and then send it to users so that the battle eye may have problems with reading this if the functions will be arranged differently each time. It is best to run the bot before turning on the Tibia client to prevent the binary code from being saved before downloading the source.
                          It's not really possible to manipulate the compiled bytecode by changing the source code. Reading about compiler optimisations will make this abundantly clear. And aside from that, you'd need to make some very significant changes to avoid any pattern recognition. A healer loop, for instance, will have a very specific pattern and that would be very easy for CipSoft to reliably detect using BattlEye.

                          Comment


                          • #14
                            I think Battle eye no Works like you say, because i have a Lot of process running in same time, Battleeye needs a great time to find specific bot.

                            Comment

                            Working...
                            X