Skip to main content

A pure Python module for recording and processing low-level Android input events (Mouse/Keyboard/Touchpad) - no dependencies

pip install geteventplayback

Tested against Windows 10 / Python 3.11 / Anaconda

GeteventPlayBack is a powerful Python module that simplifies the capture and processing of input events from Android devices, including not only touch events but also mouse and keyboard events. It is designed to work entirely with native Python, making it a versatile choice for Android input event analysis.

IMPORTANT: ONLY WORKS ON ROOTED DEVICES/EMULATORS

YT https://www.youtube.com/watch?v=LyGX7rQ-fLY

"""
Args:
	adb_path (str): The path to the 'adb' tool.
	device (str): The device event file to record, e.g., "/dev/input/event3".
	device_serial (str): The serial number or address of the Android device.
	print_output (bool): Whether to print the 'getevent' output to the console.
	tmpfolder_device (str): The temporary folder on the device to store event data.
	tempfolder_hdd (str): The temporary folder on the local HDD to store event data.
	add_closing_command (bool): Whether to add closing commands to the event replay.
	clusterevents (int): The number of events to cluster together for replay, allowing
	you to adjust playback speed.

Methods:
	- start_recording(): Start recording input events, including mouse and keyboard events,
	  and customize the playback speed.
	- _get_files_and_cmd(unpacked_data): Process the recorded data and generate
	  commands for event replay.
	- _format_binary_data(): Format binary data from 'getevent' output into events.

Attributes:
	- alldata (list): The raw 'getevent' output data, stored as bytes.
	- FORMAT (str): The format string for parsing binary data.
	- chunk_size (int): The size of each event in bytes.
	- timestampnow (float): The current timestamp.
"""
	

import subprocess

from geteventplayback import GeteventPlayBack

pla = GeteventPlayBack(
    adb_path=r"C:\Android\android-sdk\platform-tools\adb.exe",
    device="/dev/input/event4",
    device_serial="127.0.0.1:5555",
    print_output=True,
    tmpfolder_device="/sdcard/event4/",
    tempfolder_hdd=rf"C:\sadxxxxxxxxxxxx",
    add_closing_command=True,
    clusterevents=16,
)

results = pla.start_recording()

subprocess.run(
    [pla.adb_path, "-s", pla.device_serial, "shell"],
    bufsize=0,
    input=results["adbcommand"],  # Can be resused
)

Metadata

Release files for geteventplayback 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geteventplayback 0.10
File Size Uploaded Provenance Actions
geteventplayback-0.10.tar.gz 6.7 kB Without provenance Details for geteventplayback-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geteventplayback 0.10
File Interpreter ABI Platform Actions
geteventplayback-0.10-py3-none-any.whl Python 3 none any Details for geteventplayback-0.10-py3-none-any.whl

Total release size: 15.0 kB

Release files / geteventplayback-0.10.tar.gz

Download URL geteventplayback-0.10.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b74d977e9860605348b5caba85ec44000756fba3a28d7d4aa326ee658287dbdb
BLAKE2b-256 checksum
How to use checksums
1f886d8b9a088e921a35438beb01e0ccf7c19c0efba1a69aaa3e398d7cb57ec0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / geteventplayback-0.10-py3-none-any.whl

Download URL geteventplayback-0.10-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27363bc40b25f564645d864a2386690800927fb6abeccfb70d2758eae786a4f7
BLAKE2b-256 checksum
How to use checksums
f3c025712d00e3d3d817e717c601382503cfe839a2a3ed0bfc4c46cc079a92b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for geteventplayback 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page