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.
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
- Frame streaming (JPEG/raw) with real-time processing
Installation
pip install pysiphon
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> ./recordings
# Frame streaming
pysiphon stream --format jpeg --quality 85 --max-frames 100
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, "./recordings")
# Frame streaming
def process_frame(frame_data):
print(f"Frame {frame_data.frame_number}: {frame_data.width}x{frame_data.height}")
return True # Return False to stop streaming
result = client.stream_frames_to_callback(
process_frame,
format="jpeg",
quality=85,
max_frames=100
)
print(f"Streamed {result['frames_received']} frames at {result['average_fps']:.1f} FPS")
Documentation
Full documentation is available with MkDocs:
# Install docs dependencies
uv sync --group docs
# Serve locally
mkdocs serve
# Build static site
mkdocs build
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysiphon-1.0.3.tar.gz.
File metadata
- Download URL: pysiphon-1.0.3.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
930e2ee3fe81b8a287c18f15216db2593412de4fff6d04bfde340d17633add52
|
|
| MD5 |
da2b524b01949a2ef8e7d9dbda3e6922
|
|
| BLAKE2b-256 |
c4de4631049fb8d5eecab0ced4f0fc06fdeed2f49b9a69e7fdab0f35512e9835
|
Provenance
The following attestation bundles were made for pysiphon-1.0.3.tar.gz:
Publisher:
publish.yml on dhmnr/pysiphon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysiphon-1.0.3.tar.gz -
Subject digest:
930e2ee3fe81b8a287c18f15216db2593412de4fff6d04bfde340d17633add52 - Sigstore transparency entry: 707392153
- Sigstore integration time:
-
Permalink:
dhmnr/pysiphon@cf082a8497b40abf7314d14c3df4160993c77238 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dhmnr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf082a8497b40abf7314d14c3df4160993c77238 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pysiphon-1.0.3-py3-none-any.whl.
File metadata
- Download URL: pysiphon-1.0.3-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fa9809f66211915e9d75acca50d7ff1850cc126187ca5246dc52a8560a77920
|
|
| MD5 |
3e5a7415c57c7d25963ced9645bde25a
|
|
| BLAKE2b-256 |
1118f9259c922b5fb07de69c9b443b456a3b8cc5f748640c75a307563032a972
|
Provenance
The following attestation bundles were made for pysiphon-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on dhmnr/pysiphon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysiphon-1.0.3-py3-none-any.whl -
Subject digest:
1fa9809f66211915e9d75acca50d7ff1850cc126187ca5246dc52a8560a77920 - Sigstore transparency entry: 707392172
- Sigstore integration time:
-
Permalink:
dhmnr/pysiphon@cf082a8497b40abf7314d14c3df4160993c77238 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/dhmnr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf082a8497b40abf7314d14c3df4160993c77238 -
Trigger Event:
release
-
Statement type: