GithubHelp home page GithubHelp logo

bezmouse's Introduction

BezMouse

BezMouse is a lightweight tool written in Python to simulate human-like mouse movements with Bézier curves. Some applications might include:

  • aimbots (prevent bans)
  • MMORPG bots (avoid macro detection)
  • controlled macros

BezMouse was originally written for a RuneScape color bot and has never triggered macro detection in over 400 hours of continuous use.

Noteworthy Functions

move_to_img - this function takes the name of an input image (excluding file extension) and moves the mouse to a random pixel on that image if it is found on the screen. Commands for xdotool are saved to a temporary bash file in the ramdisk ./tmp called 'mouse.sh'. It is then executed as a bash script to give best performance. Note: This function is very slow because it must identify the image across your screen. It is highly recommended to find the coordinates of the image in a separate thread and feed this into the move() function.

connected_bez - connects all the (x, y) coordinates in a list of coordinates with a string of interconnected Bézier curves. A parameter deviation is required which controls how straight the lines drawn by the cursor are. Zero deviation gives straight lines. Accuracy is a percentage of the displacement of the mouse from point A to B, which is given as maximum Bézier control point deviation. Naturally, deviation of 10 (10%) gives maximum control point deviation of 10% of magnitude of displacement of mouse from point A to B, and a minimum of 5% (deviation / 2). Here is an example of connected_bez as a trace of the mouse as it passes 26 points in order, where deviation is set to 30.

connected_bez_example

move Each of the move_* functions are abstractions from the move function which handles the math of the Bézier curves such to produce realistic overshoots as well as variable speed and momentum. The following graphic was made using the draw = True argument and demonstrates the overshoot and variable speed. overshoot_example

Dependencies

Development

Find something wrong with my code? See room for improvement? Please let me know!

Regarding Performance

I am looking into injecting mouse events directly into a uinput virtual mouse. This has the benefits of:

  • minimising latency
  • giving OS-level control over mouse acceleration
  • generating perfectly smooth, coordinate independent movements
  • eliminating heavy dependencies

I will implement this feature if I can find an equivalent to uinput for Windows.

Todos

  • Make available for Windows / OSX
  • Improve performance
  • Remove dependency PyAutoGui in favour of just xdotool.

bezmouse's People

Contributors

xvol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.