Skip to main content

A human-like mouse movement automation tool based on real trajectory data

Project description

HumanMoveMouse 🖱️

PyPIPython License

🎯 Human-like mouse automation using statistical models and minimum-jerk interpolation.


Table of Contents


Overview

HumanMoveMouse is a human-like mouse automation tool built on over 300 real human mouse movement samples.

By extracting key statistical features from these trajectories and combining them with minimum-jerk interpolation, the tool enables the generation of natural, smooth, and realistic cursor paths.

These paths closely mimic real human behavior and are ideal for automation tasks requiring authenticity, such as UI testing, game botting, or user behavior simulation.


Features

  • Human-like Trajectory Generation: Generates mouse paths that follow human-like patterns based on a real-data model.

  • Multiple Mouse Actions: Supports various common operations, including moving, clicking, double-clicking, right-clicking, and dragging.

  • Highly Customizable:

    • Speed Control: Adjust movement speed via the speed_factor parameter.

    • Trajectory Smoothness: Control the number of points in the trajectory with the num_points parameter.

    • Jitter Effect: Add random jitter to make movements more realistic with the jitter_amplitude parameter.

  • Reproducibility: By setting a random seed (seed), you can generate the exact same mouse trajectory, which is useful for debugging and testing.

  • Pre-trained Model: Includes a model trained on real human mouse movements for immediate use.


Installation

You can install the package directly from PyPI:

pip install HumanMoveMouse

Quick Start

Basic Usage

from humanmouse import HumanMouseController

# Create a controller instance
controller = HumanMouseController()

# Move the mouse
controller.move((100, 100), (800, 600))

# Move and click
controller.move_and_click((100, 100), (400, 400))

# Move and double-click
controller.move_and_double_click((400, 400), (600, 300))

# Drag and drop
controller.drag((300, 300), (500, 500))

Using Current Mouse Position

# New methods that start from current mouse position
controller.move_to((800, 600))              # Move from current position
controller.click_at((400, 400))             # Move and click
controller.double_click_at((600, 300))      # Move and double-click
controller.right_click_at((500, 500))       # Move and right-click
controller.drag_to((300, 300))              # Drag from current position

Customizing Movement Parameters

# Create controller with custom parameters
controller = HumanMouseController(
    num_points=200,           # More points = smoother movement
    jitter_amplitude=0.2,     # Less jitter = straighter path
    speed_factor=0.5          # Slower movement
)

# Set speed dynamically
controller.set_speed(2.0)  # Double speed
controller.move((100, 100), (800, 600))

API Reference

HumanMouseController

__init__(self, model_pkl=None, num_points=100, jitter_amplitude=0.3, speed_factor=1.0)

Initialize the controller.

Parameters:

  • model_pkl (str, optional): Path to a custom model file. If None, uses the built-in model.
  • num_points (int): Number of trajectory points. Higher = smoother. Default: 100.
  • jitter_amplitude (float): Random jitter magnitude. 0 = no jitter. Default: 0.3.
  • speed_factor (float): Movement speed multiplier. >1 = faster, <1 = slower. Default: 1.0.

move(self, start_point, end_point, seed=None)

Move the mouse from start to end point.

Parameters:

  • start_point (tuple): Starting coordinates (x, y).
  • end_point (tuple): Target coordinates (x, y).
  • seed (int, optional): Random seed for reproducible trajectories.

move_and_click(self, start_point, end_point, seed=None)

Move to a location and perform a single click.

move_and_double_click(self, start_point, end_point, seed=None)

Move to a location and perform a double click.

move_and_right_click(self, start_point, end_point, seed=None)

Move to a location and perform a right click.

drag(self, start_point, end_point, seed=None)

Drag from start to end point (press and hold left button).

set_speed(self, speed_factor)

Dynamically adjust movement speed.

Parameters:

  • speed_factor (float): New speed multiplier (must be > 0).

Methods Starting from Current Position

move_to(self, end_point, seed=None)

Move from current mouse position to target position.

Parameters:

  • end_point (tuple): Target coordinates (x, y).
  • seed (int, optional): Random seed for reproducible trajectories.

click_at(self, end_point, seed=None)

Move from current position to target and perform a single click.

double_click_at(self, end_point, seed=None)

Move from current position to target and perform a double click.

right_click_at(self, end_point, seed=None)

Move from current position to target and perform a right click.

drag_to(self, end_point, seed=None)

Drag from current position to target (press and hold left button).


Advanced Usage

Using Custom Models

If you have a custom-trained model file, you can load it:

controller = HumanMouseController(model_pkl="path/to/your/model.pkl")

Training Your Own Model

For training custom models with your own mouse movement data, please refer to the GitHub repository which includes:

  • Data collection tools
  • Model training scripts
  • Complete development environment

License

This project is licensed under the MIT License - see the LICENSE file for details.


Disclaimer

⚠️ IMPORTANT NOTICE

This project is provided for educational and research purposes only. By using this software, you agree to the following terms:

  1. Legal Use Only: This tool must only be used in compliance with all applicable laws and regulations. Users are solely responsible for ensuring their use complies with local, state, federal, and international laws.

  2. No Malicious Use: This software must NOT be used for any malicious, harmful, or illegal activities, including but not limited to:

    • Unauthorized access to computer systems
    • Circumventing security measures or access controls
    • Creating or distributing malware
    • Violating terms of service of any platform, application, or website
    • Automated interactions with services that prohibit such behavior
    • Any form of fraud, deception, or harassment
  3. User Responsibility: Users assume full responsibility and liability for their use of this software. The developers and contributors:

    • Are NOT responsible for any misuse or damage caused by this tool
    • Do NOT endorse or encourage any illegal or unethical use
    • Cannot be held liable for any consequences resulting from the use of this software
  4. No Warranty: This software is provided "AS IS" without warranty of any kind, express or implied. The developers make no guarantees about its:

    • Suitability for any particular purpose
    • Reliability, accuracy, or performance
    • Compatibility with any specific system or application
  5. Ethical Use: Users are expected to use this tool ethically and responsibly, respecting the rights and privacy of others.

By using this software, you acknowledge that you have read, understood, and agree to be bound by these terms.


Contributing

Contributions are welcome! Please check out the GitHub repository for development setup and guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

humanmovemouse-1.0.0.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

humanmovemouse-1.0.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file humanmovemouse-1.0.0.tar.gz.

File metadata

  • Download URL: humanmovemouse-1.0.0.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for humanmovemouse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d287eefa168fadf767ed9e9e5ea21711ba2dfa6a49c86b3fcab5bd3c1a9a52a1
MD5 af24eeaad36089a8253e0b2e8941965b
BLAKE2b-256 4a2a3be4235de2583d48cd92883412316403feda51fa8c944442798100cea78b

See more details on using hashes here.

File details

Details for the file humanmovemouse-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: humanmovemouse-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for humanmovemouse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa2070bad2dfd8d06712e46740e29981d78664bca41996ba9987808fea3b014d
MD5 5b4a6e4782df17b16893fd7af6ed1128
BLAKE2b-256 c4bc2bf02818576df44506041fe15edf9d9315bad14ecc218ed3fa6ed9ca53fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page