Skip to main content

Python gRPC client for Siphon service - memory manipulation, input control, and screen capture

Project description

pysiphon

Python gRPC client for Siphon service - provides memory manipulation, input control, screen capture, and recording capabilities.

📚 Documentation

Features

  • Dual-Mode CLI: Interactive REPL and single-command execution
  • Programmatic API: Use as a Python library
  • Complete RPC Coverage: All Siphon service methods supported
    • Memory manipulation (read/write attributes)
    • Input control (keyboard, mouse)
    • Screen capture
    • Command execution
    • Recording sessions with HDF5 output

Installation

# Install dependencies
uv pip install -e .

# Or with pip
pip install -e .

Usage

CLI - Interactive Mode

Start an interactive session:

pysiphon interactive

Example session:

> init config.toml
> status
> get health
> set speed int 100
> capture screenshot.png
> input w,a,s,d 50 10
> rec-start ./output health,mana,position 30
> rec-stop <session-id>
> quit

CLI - Single Command Mode

Execute individual commands:

# Initialize from config
pysiphon init config.toml

# Check server status
pysiphon status

# Get/set attributes
pysiphon get health
pysiphon set speed int 100
pysiphon set position array "6D DE AD BE EF"

# Input control
pysiphon input w,a,s,d 50 10
pysiphon toggle shift 1
pysiphon move 100 50 10

# Screen capture
pysiphon capture screenshot.png

# Execute remote commands
pysiphon exec notepad.exe

# Recording
pysiphon rec-start ./output health,mana 30
pysiphon rec-status <session-id>
pysiphon rec-stop <session-id>
pysiphon rec-download <session-id> recording.h5

Custom Server Address

pysiphon --host 192.168.1.100:50051 interactive
pysiphon --host 192.168.1.100:50051 status

Programmatic API

Use pysiphon as a Python library:

from pysiphon import SiphonClient

# Create client
with SiphonClient("localhost:50051") as client:
    # Initialize all subsystems
    client.init_all("config.toml")
    
    # Get/set attributes
    result = client.get_attribute("health")
    print(f"Health: {result['value']}")
    
    client.set_attribute("speed", 100, "int")
    
    # Input control
    client.input_key_tap(["w", "a", "s", "d"], hold_ms=50, delay_ms=10)
    client.move_mouse(delta_x=100, delta_y=50, steps=10)
    
    # Capture frame
    image = client.capture_frame(as_image=True)  # Returns PIL Image
    image.save("screenshot.png")
    
    # Or save directly
    client.capture_and_save("screenshot.jpg")
    
    # Execute commands
    result = client.execute_command("notepad.exe")
    print(f"Exit code: {result['exit_code']}")
    
    # Recording
    result = client.start_recording(
        attribute_names=["health", "mana"],
        output_directory="./recordings",
        max_duration_seconds=30
    )
    session_id = result["session_id"]
    
    # Check status
    status = client.get_recording_status(session_id)
    print(f"Frames: {status['current_frame']}")
    
    # Stop and download
    stats = client.stop_recording(session_id)
    print(f"FPS: {stats['actual_fps']:.1f}")
    
    client.download_recording(session_id, "recording.h5")

Documentation

Full documentation is available with MkDocs:

# Install docs dependencies
pip install -e ".[docs]"

# Serve locally
mkdocs serve

# Build static site
mkdocs build

Visit http://127.0.0.1:8000 to view the documentation.

Documentation includes:

  • Getting Started guides
  • Complete API reference
  • CLI usage examples
  • Recording guide
  • Development guide

License

See LICENSE file for details.

Contributing

Contributions welcome! Please ensure:

  • Code follows existing style
  • All features have corresponding CLI commands
  • API methods return consistent dictionary structures
  • Documentation is updated

See Contributing Guide for details.

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

pysiphon-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

pysiphon-0.1.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file pysiphon-0.1.0.tar.gz.

File metadata

  • Download URL: pysiphon-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysiphon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ca874aaa34ab638a5eace65a9727e167d049067b170bf275c671ca81cf16c03
MD5 9e9fa47d61d0b484291d15bfdde381c4
BLAKE2b-256 c45215b45e44aef4ced0463c2917457955ad234ddbf8bc85f55460269d343feb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiphon-0.1.0.tar.gz:

Publisher: publish.yml on dhmnr/pysiphon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysiphon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysiphon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysiphon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63c8205ccdf55d0f73398cf420c91c09e9f77a28b293d7461499811a06346225
MD5 cf08bf073c0cb503237e39021757f1ee
BLAKE2b-256 f1b7271f66c9383897dc6c8af2cc92157c81d07fbb7c09823ae01052ff97163a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysiphon-0.1.0-py3-none-any.whl:

Publisher: publish.yml on dhmnr/pysiphon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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