Last active
February 28, 2026 14:28
-
-
Save fumin/ae126f1c4da046123dc19e5d7e3b0e58 to your computer and use it in GitHub Desktop.
fake presence to fool websites such colab by moving mouse randomly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _dev=$(ls -1 /dev/input/by-id/*event-mouse | tail -1) | |
| [ -z "${_dev}" ] && echo "Cannot find mouse event device" && exit 1 | |
| echo "Using ${_dev}" | |
| IS_MOVE=1 | |
| X_PIXELS=0 | |
| Y_PIXELS=0 | |
| while [ true ] | |
| do | |
| sleep 10 | |
| # Move mouse. | |
| if [ $IS_MOVE == 1 ]; then | |
| IS_MOVE=0 | |
| X_PIXELS=$(echo $((-50 + $RANDOM % 100))) | |
| Y_PIXELS=$(echo $((-50 + $RANDOM % 100))) | |
| else | |
| IS_MOVE=1 | |
| X_PIXELS=$((-X_PIXELS)) | |
| Y_PIXELS=$((-Y_PIXELS)) | |
| fi | |
| /usr/bin/evemu-event ${_dev} --type EV_REL --code REL_X --value $X_PIXELS --sync | |
| /usr/bin/evemu-event ${_dev} --type EV_REL --code REL_Y --value $Y_PIXELS --sync | |
| # Mouse click. | |
| /usr/bin/evemu-event ${_dev} --type EV_KEY --code BTN_LEFT --value 1 --sync | |
| /usr/bin/evemu-event ${_dev} --type EV_KEY --code BTN_LEFT --value 0 --sync | |
| echo -n "#" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment