Skip to main content

Python bindings for KmBox Net

Project description

KmBoxNet

PyPI

高性能的 KmBoxNet (网络版) Python 绑定库,基于 Rust 开发。

High-performance Python bindings for KmBoxNet, written in Rust.

硬件请见官网:https://www.kmbox.top/

功能特性 (Features)

  • 🚀 高性能: 核心通讯逻辑由 Rust 实现,极低延迟。
  • 🖱️ 全功能控制: 支持鼠标移动、点击、滚轮,键盘按键控制。
  • 🔐 加密通信: 支持加密协议,防止数据包特征检测。
  • 👀 硬件监听: 支持监听物理键鼠的输入事件 (Monitor模式)。
  • 🖼️ LCD控制: 支持修改屏幕颜色、显示图片。
  • 🔧 硬件算法: 内置贝塞尔曲线等硬件级轨迹修正算法。

安装 (Installation)

使用 pip 安装:

pip install kmbox-net-rust

注意:在代码中导入时请使用 import kmbox_net

快速开始 (Quick Start)

1. 连接设备与控制

import kmbox_net
import time

# 连接设备
# IP: 盒子显示的IP (例如 192.168.2.188)
# Port: 端口 (默认 8888)
# MAC: 盒子MAC地址 (例如 "0B50E466"),用于握手和加密
client = kmbox_net.KmBoxNetClient("192.168.2.188", 8888, "0B50E466")

# 鼠标相对移动 (X=100, Y=100)
client.mouse_move(100, 100)

# 鼠标左键点击
client.mouse_left(True)  # 按下
time.sleep(0.05)
client.mouse_left(False) # 松开

# 键盘输入 (按下 'A')
client.keydown(kmbox_net.KEY_A)
time.sleep(0.05)
client.keyup(kmbox_net.KEY_A)

2. 监听物理键鼠 (Monitor)

import kmbox_net
import time

# 定义回调函数
def on_event(mouse: kmbox_net.HardMouse, keyboard: kmbox_net.HardKeyboard):
    # 打印鼠标数据
    if mouse.buttons != 0 or mouse.x != 0 or mouse.y != 0:
        print(f"[Mouse] Btn:{mouse.buttons} X:{mouse.x} Y:{mouse.y}")
    
    # 打印键盘数据
    if keyboard.data:
        print(f"[Keyboard] Keys:{keyboard.data}")

# 1. 在本地端口 12345 开启监听线程
monitor = kmbox_net.KmBoxNetMonitor(12345, on_event)

# 2. 告诉盒子把数据推流到这个端口
# 注意:你需要先连接上盒子
client = kmbox_net.KmBoxNetClient("192.168.2.188", 8888, "0B50E466")
client.monitor(12345)

print("正在监听物理键鼠输入... 按 Ctrl+C 停止")
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    client.monitor(0) # 停止推流
    monitor.shutdown() # 停止本地监听

3. 加密功能 (Encryption)

import kmbox_net

# 使用加密通道移动鼠标 (防止抓包特征)
client.enc_mouse_move(100, 100)

# XXTEA 加密工具函数 (原地修改)
data = bytearray(128)
key = b"1234567890123456"
kmbox_net.xxtea_encrypt(data, key)

编译指南 (Building from source)

如果你需要自己编译项目,需要安装 Rust 工具链。

# 安装 maturin
pip install maturin

# 编译并安装到当前环境
maturin develop --release

License

MIT

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

kmbox_net_rust-1.0.2.tar.gz (657.6 kB view details)

Uploaded Source

Built Distributions

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

kmbox_net_rust-1.0.2-cp39-abi3-win_amd64.whl (212.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

kmbox_net_rust-1.0.2-cp39-abi3-win32.whl (198.9 kB view details)

Uploaded CPython 3.9+Windows x86

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (367.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (398.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (492.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (391.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (369.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (368.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

kmbox_net_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl (327.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

kmbox_net_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl (328.2 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file kmbox_net_rust-1.0.2.tar.gz.

File metadata

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

File hashes

Hashes for kmbox_net_rust-1.0.2.tar.gz
Algorithm Hash digest
SHA256 05a158810dfbe27bd9d42e2507662021db3dec0e7de57e0e03e549932566a420
MD5 d5a1f123eabcc33ec58d0eefeeb8cb45
BLAKE2b-256 65339883c9740638fae7adadec4aa6d80d7eb6b1832f6fb403017151b1a6b467

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2.tar.gz:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c31ddcee0b36026178c2bfbd38a6ff7cb6be556643c75a1461798e1d0503d1c2
MD5 b091586e1da8e630c9d7acf20748cba4
BLAKE2b-256 b3bb1a4d14c478a1aa258a9816560bc0d30086673d4b841959208a5142b4f527

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-win_amd64.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-win32.whl.

File metadata

  • Download URL: kmbox_net_rust-1.0.2-cp39-abi3-win32.whl
  • Upload date:
  • Size: 198.9 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 551a9c56986c5dad4432eccbd9a795c8b9ae2fc6d00e155b409bfa9295c2f99c
MD5 6ed8e75f7561e19d0408e1e23e34f9b1
BLAKE2b-256 cf46724afdb8d587a7fe106b5cf0ebf18fd5f9b51ee12d559d10a4a2b34b1a6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-win32.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c0070231988f3580096cc1ee411697eef6b312fb289a396befc4e3b54f6e680
MD5 c657db4689544f412985612bebc5c756
BLAKE2b-256 6dfe2f5756324ea562f2fc1332de4fe7cdabb760791d36b8e1cc8f730b54895d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 750440697d601efd67bf2b7c0cab20a0e5c3a3b0d0910126838eafd29960f6d0
MD5 60a8c1787d43cfb665debc82e64c0cb8
BLAKE2b-256 cfa9ce204576656b320f10ce75e41fe6508f9b240c41c2a4058473b090f75976

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 3fd480d2a313a318c9de4e112fc37c7a07296b7cc0f42b77e140effac3fe57c8
MD5 96e49bdcf180853cbc0c57073ba7b2dc
BLAKE2b-256 f520bd346da2345c6d4e4cd8ddf66b8e69c31dcb4eee03bcdb1abd1a529f7dde

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7c1585d6a1a262a446bf8f18ce976e4ef39cf5c07446033e5074625b2007f379
MD5 cb96c7c80e5b9daa864aa969422c5bfc
BLAKE2b-256 2a4ef5f6f49c9ed401f45e40c92343ea236f25db3c93a7970e8c4b11bb0a73e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9274b9e937eff86d2ff8f41e993e3e2ca79627988eeeb0c5a9503cf87121c112
MD5 31eeeeeadc5f434bee108db89715e2bb
BLAKE2b-256 00dbd213f948f7406f69888f66d1e478b8e6bd2f654350417094cae91c3fb0fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3a19eb76def8d9dad51b586414535539b5896936fecef7045b7da735f2213ff
MD5 e394fbf8c20f5e251da53cce7eb7ec59
BLAKE2b-256 8c5cff45fd275ed8bfa6075a34531e99f102ab00296cac9b949066e937ff61ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17c795be82331271274f7fc5f416d336d38b09431de6f10fb139b05542a0825d
MD5 7bdfbe225b85ba3166b06cb152701443
BLAKE2b-256 0ccf37a0b16f87cecae757dc5c281818d0a962fb5aebdcc191fa5b509f0aa871

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on 7owen/KmBoxNet

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

File details

Details for the file kmbox_net_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 85853be2f59ce57e7981ddbd6b509da82150fb22037ce6ef6a5dc915cc946382
MD5 196423411ed62681a056c5319f48feca
BLAKE2b-256 06d91cea561f17e6609326db26b1bd482c5096b5637ce8b2c6dd3a0a5d5e7f3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on 7owen/KmBoxNet

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