Skip to content

Stealth-Keep-Awake — a pure-Python script that fakes human activity with random Bézier mouse moves, clicks, scrolls & keystrokes while blocking screen sleep on macOS/Win/Linux.

Notifications You must be signed in to change notification settings

LaXnZ/stealth-keep-awake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🖱️ Stealth-Keep-Awake

Randomised mouse-&-keyboard “keep alive” script for macOS, Windows and Linux.

  • ✅ Human-like curved cursor paths
  • ✅ Truly random delays (exponential distribution)
  • ✅ Optional clicks, scrolls, and “fake” typing noise
  • ✅ Sleep-proof on macOS via caffeinate (Windows / Linux equivalents documented)
  • ✅ CSV logging for later analysis
  • ✅ Zero external services – pure Python, open source

⚠️ Ethics & Risk This project is for educational purposes only. Using it to bypass a platform’s idle or activity rules can violate their Terms of Service. You are solely responsible for how you use it.

Table of Contents

  1. Demo
  2. Features
  3. Install
  4. Quick Start
  5. Configuration
  6. How It Works
  7. Platform Notes
  8. Contributing
  9. License

Demo

[caffeinate] running in the background to block sleep
Keep-awake (sleep-proof) started  – press Ctrl-C to quit
[2025-06-29T23:42:11] move (652,533)
[2025-06-29T23:42:11] click (652,533)
[2025-06-29T23:44:21] move (1131,274)
[2025-06-29T23:46:07] scroll
...

Features

Category Details
Natural movement Cubic-Bézier paths with 20–60 sub-segments, tiny timing jitter (5–15 ms).
Random timing Action gaps follow an exponential curve – no mechanical “every 60 s” pattern.
Mixed events Low-probability clicks, scrolls, keystrokes (typed + auto-backspaced).
Sleep blocker Launches caffeinate -dimsu on macOS; Windows/Linux one-liners provided.
Failsafe Ctrl-C cleanly stops the script and releases the sleep inhibitor.
Logging Optional log.csv → timestamp, event type, X, Y – easy to load in Pandas.

Install

1 · Clone

git clone https://github.com/yourname/stealth-keep-awake.git
cd stealth-keep-awake

2 · Create & activate a virtualenv

python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

3 · Install requirements

pip install -r requirements.txt

requirements.txt

pyautogui==0.9.54
pyobjc==10.1 ; platform_system == "Darwin"

On macOS the first time you run the script, grant Accessibility permission when prompted.

Quick Start

python keep_awake.py

You’ll see live log lines. Press Ctrl + C to stop.

Configuration

Open keep_awake.py and adjust the constants at the top:

Constant Purpose Default
WAIT_MEAN_SECONDS Average pause between actions 120
MAX_WAIT_SECONDS Hard cap to beat display-off timers 240
CLICK_PROB Chance a move ends with a click 0.20
TYPE_PROB Chance to type / erase random text 0.07
SCROLL_PROB Chance to scroll after a move 0.06
EDGE_MARGIN How far to stay away from screen edge 120
CSV_LOG File name to log events (“” disables) ""

All randomness is generated per-action, so two runs never look the same.

How It Works

  1. Wait – sleeps a random expovariate delay, capped below the OS sleep limit.
  2. Move – picks a safe random point and glides there along a Bézier curve.
  3. Noise – with small probabilities performs a click, scroll, or fake typing.
  4. Loop – repeats indefinitely while the script is running.
  5. Sleep guard – on macOS, caffeinate keeps the display and system awake.

Platform Notes

OS Sleep-prevention tip
macOS Built-in: caffeinate -dimsu (already started by the script).
Windows Add before the main loop:
import ctypes
ctypes.windll.kernel32.SetThreadExecutionState(0x80000002)
Linux / systemd Run under:
systemd-inhibit --why="stealth-keep-awake" python keep_awake.py

Contributing

Pull requests and ideas welcome! Please open an issue first if you’d like to add a major feature.

# run linter & basic checks
pip install ruff pytest
ruff check .
pytest

License

MIT © 2025 Your Name See LICENSE for details.

Disclaimer

This repository is provided as is. The maintainers are not responsible for any policy violations, bans, or other consequences that may arise from its use.

About

Stealth-Keep-Awake — a pure-Python script that fakes human activity with random Bézier mouse moves, clicks, scrolls & keystrokes while blocking screen sleep on macOS/Win/Linux.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages