Skip to main content

Cross-platform keyboard input simulation and monitoring

Project description

KeystrokeSimulator

A comprehensive Python library for keyboard input simulation and monitoring, developed by Bassem Abidi (abidi.bassem@me.com).

Features

Keystroke Simulation

  • 🎯 Cross-platform support (Windows, macOS, Linux)
  • ⌨️ Simulate individual keystrokes
  • 📝 Type strings with customizable delays
  • 🔥 Support for hotkey combinations
  • 🔧 Custom keyboard layout definitions

Keyboard Monitoring

  • 📊 Real-time keystroke logging
  • 📈 Detailed keystroke statistics
  • 🔍 Key combination tracking
  • 📅 Date-organized logs
  • 📊 Usage analytics

Quick Start

Installation

pip install keystroke-sim

Command Line Usage

  1. Monitor keyboard input:
# Basic monitoring
sudo keystroke-sim monitor

# Advanced options
sudo keystroke-sim monitor --track-all --max-combo-keys 4
  1. Simulate keystrokes:
# Type text
keystroke-sim simulate --text "Hello, World!" --delay 0.1

# Press hotkey
keystroke-sim simulate --hotkey ctrl c

Python API Usage

from keystroke_sim import KeystrokeSimulator, KeyboardMonitor

# Simulate keystrokes
sim = KeystrokeSimulator()
sim.type_string("Hello, World!", delay=0.1)
sim.press_hotkey(['ctrl', 'c'])

# Monitor keyboard
monitor = KeyboardMonitor()
monitor.start()  # Starts monitoring

Features in Detail

Keyboard Monitoring

  1. Real-time Logging

    • Timestamps for all events
    • Key press and release tracking
    • Key combination detection
    • Organized daily log files
  2. Statistics Collection

    • Total keystroke count
    • Most frequent keys
    • Common key combinations
    • Usage patterns
  3. Data Organization

    logs/
    ├── 2024-01-15/
    │   ├── keystrokes_123456.log
    │   └── keystrokes_123456_stats.json
    └── 2024-01-16/
        ├── keystrokes_234567.log
        └── keystrokes_234567_stats.json
    

Keystroke Simulation

  1. Basic Operations

    • Individual key presses
    • String typing
    • Hotkey combinations
    • Custom delays
  2. Custom Layouts

    layout = {
        'special_key': 'enter',
        'custom_combo': ['ctrl', 'shift', 'x']
    }
    sim.set_keyboard_layout(layout)
    

Configuration

Monitor Configuration Options

keystroke-sim monitor [OPTIONS]

Options:
  --log-file PATH          Custom log file path
  --no-combinations        Disable logging of key combinations
  --no-stats              Disable collection of keystroke statistics
  --track-all             Track all keys including modifiers
  --max-combo-keys N      Maximum keys in combinations (default: 3)

Simulation Configuration Options

keystroke-sim simulate [OPTIONS]

Options:
  --text TEXT             Text to type
  --hotkey KEY...         Hotkey combination (e.g., ctrl c)
  --delay SECONDS         Delay between keystrokes (default: 0.1)

Platform-Specific Requirements

Linux

# Run with sudo for keyboard access
sudo keystroke-sim monitor

macOS

  • Grant accessibility permissions
  • Allow terminal access in Security & Privacy

Windows

  • Run as administrator for certain applications

Safety and Privacy

  1. Data Security

    • Local logging only
    • No network transmission
    • Clear log file locations
  2. Transparency

    • All operations are logged
    • Statistics are saved locally
    • No hidden functionality

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: python -m pytest tests/
  5. Submit a pull request

Support

For issues, questions, or contributions:

License

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

Author

Bassem Abidi (abidi.bassem@me.com)

Version History

See CHANGELOG.md for version history and changes.

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

keystroke_sim-0.2.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

keystroke_sim-0.2.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file keystroke_sim-0.2.1.tar.gz.

File metadata

  • Download URL: keystroke_sim-0.2.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for keystroke_sim-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5c4c0c3cd2f5c53fe976f713411a1166d3618accdbc0be14193ddd8d9ffd4ae5
MD5 f41f784b922f0862c5f162d1b466a035
BLAKE2b-256 51455b4bc04c7ec34efd1d2d6f813351f61402d1dba63010747c2385b12306c8

See more details on using hashes here.

File details

Details for the file keystroke_sim-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: keystroke_sim-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for keystroke_sim-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27c4212d6377bf2f9053663cd130b81580e0d51e8b1fdf6b511c404ec073c461
MD5 768120a47a8f7b8f06131af6359a933d
BLAKE2b-256 8b45b47f36affff3a632701ee60252ba7a39fc9a724cbae5c9ba04466b6534fa

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