Enable autofire for any key. Press once, then leave your computer running—Auto Fire handles the rest.
Auto Fire is a powerful automation tool that enables continuous key pressing without manual intervention. Simply enable the script, press your desired key once, and the tool will automatically repeat that key press at configurable intervals. Perfect for tasks requiring repetitive key presses while you're away from your computer.
Whether you're automating game mechanics, completing repetitive data entry tasks, or running extended simulations, Auto Fire provides a reliable, lightweight solution with minimal dependencies and maximum control.
- One-Key Activation: Press any key once to start auto-pressing
- Configurable Intervals: Adjust key press frequency from milliseconds to seconds
- Instant Shutdown: Stop with a secure key combination (Ctrl+Esc+W)
- Robust Fallback: Automatic CLI mode if keyboard listener fails
- Lightweight: Minimal resource usage with no heavy dependencies
- Dual Library Support: Works with both
keyboardandpynputlibraries - Cross-Platform: Runs on Windows, Linux, and macOS
- Gaming: Automate repetitive key presses in games (farming, mining, AFK tasks)
- Data Entry: Speed up repetitive form filling and data processing
- Testing: Automate keyboard input for testing purposes
- Simulations: Run long-duration simulations with constant input
- Accessibility: Reduce repetitive strain for users with mobility constraints
- Automation: Execute keyboard-dependent automation workflows
- Python 3.6 or higher
- One of the following libraries:
keyboard(preferred)pynput(fallback)
- Python 3.6 or higher installed on your system
- Administrator/root privileges (required for global keyboard access)
- Clone the repository:
git clone https://github.com/sinha-19/Auto-Fire.git
cd Auto-Fire- Install required dependencies:
pip install -r requirements.txt- (Optional) Create a virtual environment for isolation:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Run with administrator privileges:
# Linux/macOS
sudo python rapid_fire.py
# Windows (run terminal as Administrator first)
python rapid_fire.py-
Start auto-pressing: Press any key to begin auto-pressing that key
- The key will repeat every 1 second by default
- Works with any keyboard key or key combination
-
Stop auto-pressing: Press Ctrl+Esc+W simultaneously
- Instant shutdown of auto-pressing functionality
- Can be customized (see Advanced Configuration)
If the keyboard listener fails to initialize (common on some Linux systems), the program automatically switches to Command-Line Interface (CLI) mode.
Available commands in CLI mode:
start <key>- Start auto-pressing a key- Example:
start aorstart space
- Example:
stop- Stop current auto-pressinginterval <seconds>- Change the press interval- Example:
interval 0.5
- Example:
exitorquit- Exit the program
For special keys in CLI mode, use these keywords:
| Keyword | Key |
|---|---|
space |
Space bar |
enter |
Enter/Return key |
tab |
Tab key |
esc or escape |
Escape key |
ctrl |
Control key |
alt |
Alt key |
shift |
Shift key |
For regular character keys, just type the character (e.g., a, b, 1, 2).
Scenario 1: Gaming - AFK Farming
- Start the script with sudo/admin
- In your game, position character in a safe location
- Press spacebar to initiate auto-firing
- Your character will jump repeatedly at 1-second intervals
- Press Ctrl+Esc+W to stop when done
Scenario 2: Data Entry - Repetitive Form Submission
- Run the script
- Position cursor in the form input field
- Press Tab or Enter to auto-submit forms
- Adjust interval to 0.5 seconds for faster submission
- Stop with Ctrl+Esc+W when complete
Scenario 3: CLI Mode Usage
python rapid_fire.py
# If keyboard listener fails, you'll get CLI prompt
start space
# spacebar now auto-pressing
interval 0.5
# change to 0.5 second intervals
stop
# stop auto-pressing
exit
# exit programEdit rapid_fire.py to modify the default press interval:
# In the main block, adjust the interval parameter (in seconds)
rapid_fire = RapidFire(interval=0.5) # Default: 1.0 second
# 0.1 = 10 times per second (gaming)
# 0.5 = 2 times per second (moderate)
# 1.0 = once per second (default, slower)
# 2.0 = once every 2 seconds (very slow)# Change the stop combination in the script
self.stop_combo = "ctrl+esc+w" # Current setting
# Examples of alternatives:
# self.stop_combo = "ctrl+shift+x"
# self.stop_combo = "esc+esc"
# self.stop_combo = "alt+f4"from pynput.keyboard import Key, KeyCode
# Modify the stop_keys set
self.stop_keys = {Key.ctrl_l, Key.esc, KeyCode.from_char('w')}
# Examples:
# self.stop_keys = {Key.ctrl_l, Key.shift_l, KeyCode.from_char('x')}
# self.stop_keys = {Key.esc, Key.esc} # Double escapeFor optimal performance:
- Gaming: Use 0.1-0.2 second intervals
- Data Entry: Use 0.5-1.0 second intervals
- Simulations: Use 1.0-2.0 second intervals
- Experiment with values that work best for your use case
This utility requires elevated privileges due to system-level keyboard access:
-
Linux: Run with
sudoprivilegesudo python rapid_fire.py
-
Windows: Launch terminal as Administrator before running the script
-
macOS: Grant Accessibility permissions in System Preferences
sudo python rapid_fire.py
- Always Know Your Exit: Memorize your stop key combination (default: Ctrl+Esc+W)
- Testing First: Test in a safe environment before automation
- Terms of Service: Verify that automation complies with your target application's terms of service
- Game Policy: Some games may prohibit automation tools—use at your own risk
- Monitoring: Don't leave automation running unattended for extended periods
- Emergency Stop: You can always press Ctrl+C in the terminal to forcefully exit
Problem: "Keyboard listener failed. Switching to command-line interface mode"
Solution: This is normal on some systems, especially Linux. The program automatically falls back to CLI mode with full functionality.
What to do:
- The CLI mode works just as well as keyboard listener mode
- Use commands like
start spaceandstopas described in Fallback CLI Mode section - No action needed—the script handles this automatically
Problem: Permission denied when running the script
Solution:
- Linux/macOS: Run with
sudosudo python rapid_fire.py
- Windows: Right-click terminal and select "Run as Administrator"
- Alternative: Grant specific permissions to your user (advanced)
Problem: ImportError for keyboard or pynput
Solution: Install both libraries explicitly:
pip install keyboard pynputIf that fails:
pip install --upgrade keyboard pynput
# Or try with user flag
pip install --user keyboard pynputProblem: Pressed keys aren't being registered
Possible Causes & Solutions:
- Terminal doesn't have keyboard focus—click on the terminal window
- Running without proper permissions—use
sudo(Linux/macOS) - Virtual machine limitations—some VMs restrict keyboard access
- Try switching to CLI mode if keyboard listener fails
Problem: Program becomes unresponsive
Solution:
- Press your stop key combination (default: Ctrl+Esc+W)
- If that doesn't work, press Ctrl+C in the terminal
- Check terminal output for error messages
Problem: Ctrl+Esc+W doesn't stop the auto-pressing
Solutions:
- Try pressing the keys separately with slight delays
- Try Ctrl+C in the terminal window
- Close the terminal window entirely
- Use Task Manager (Windows) or Activity Monitor (macOS) to force-close Python
Q: Is this tool safe to use? A: Yes, when used responsibly. It's a simple key press automation tool. Always be aware of your stop key combination and test in safe environments first.
Q: Will this get me banned from games? A: That depends on the game's terms of service. Some games explicitly prohibit automation tools. Use at your own risk and only on games where automation is permitted.
Q: What's the minimum interval I can use? A: You can go as low as 0.01 seconds (100 times per second), but keyboard hardware limitations typically cap out around 50-100 presses per second.
Q: Does this work on Linux?
A: Yes! Linux is fully supported. You'll need to run with sudo for global keyboard access.
Q: Can I use this on macOS?
A: Yes! macOS is supported. Grant Accessibility permissions when prompted, and run with sudo if needed.
Q: Can this tool capture passwords or sensitive data? A: No. This tool only simulates key presses—it doesn't read or capture keyboard input from other applications.
Q: What if I forget my stop key combination? A: You can always press Ctrl+C in the terminal to force exit the program.
Q: Can I run multiple instances? A: Yes, but it's not recommended as they may interfere with each other. Test first.
-
Keyboard Listener Mode (primary):
- Monitors global keyboard input using the
keyboardlibrary - Listens for any key press to start auto-pressing
- Monitors for the stop key combination to halt auto-pressing
- Repeats the target key at specified intervals
- Monitors global keyboard input using the
-
CLI Mode (fallback):
- Automatically activated if keyboard listener initialization fails
- Provides command-line interface for manual control
- Same functionality as keyboard listener mode
- OS: Windows 10+, Linux (any distribution), macOS 10.12+
- Python: 3.6 or higher
- Permissions: Administrator/root access required
- Dependencies: keyboard or pynput library
The tool uses a simple threading model:
- Main thread listens for keyboard input
- Worker thread handles key pressing at specified intervals
- Stop signal from keyboard listener terminates the worker thread
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MPL-2.0 license - see the LICENSE file for details.
Saket Kumar Sinha
