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.

功能特性 (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.1.tar.gz (655.5 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.1-cp39-abi3-win_amd64.whl (200.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

kmbox_net_rust-1.0.1-cp39-abi3-win32.whl (186.2 kB view details)

Uploaded CPython 3.9+Windows x86

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (357.0 kB view details)

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

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (391.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (502.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (382.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (357.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (359.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

kmbox_net_rust-1.0.1-cp39-abi3-macosx_11_0_arm64.whl (316.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

kmbox_net_rust-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl (316.6 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: kmbox_net_rust-1.0.1.tar.gz
  • Upload date:
  • Size: 655.5 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.1.tar.gz
Algorithm Hash digest
SHA256 5064a1c5ecec9ceef367d9af0e6bf5aee0ac153d3ad044bbc39421d9636e8a20
MD5 98a12c68839335bb6793ced46a25aa1d
BLAKE2b-256 c354272506f9d9f8b453f711e9b19d230dee0e56dc635118ede5c01307e20ac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1.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.1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a5fa3845fb603bd05a6b86fe752c6411de276128394b5fec333beec4ef5c106d
MD5 8dc7198ad43053c23300d36b4cf3affc
BLAKE2b-256 415f482ca82585e401a2ce566e2115e30d889ce6077e51c4b15afa52eb8b6e5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-win32.whl.

File metadata

  • Download URL: kmbox_net_rust-1.0.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 186.2 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.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 d50bcc1e92948f4fcdfda58f96bd5bcacbba5c3db0f3d2986f839f8991a39f31
MD5 67d9f4a26a4cd000859f073a2ebed4d0
BLAKE2b-256 be3e08f505a1e53c1d1032de2499f055c3c92716af2be6fc0376b12ab3f6654c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aff5d1a60f3ae3d3a4e0b139821c10335d03774f3b2c31b5a4a9f6c533511422
MD5 9513796fac712c43ecae726d476efe9b
BLAKE2b-256 7d3e363b3587254197ee27e673bfec28f7a20e7c74a36c66de508ecc43355188

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 40e7f7dfb473bb8e45c549ddb07cd1763e11c4c5703188a885a9d963699e2eff
MD5 ece1bb444ab59164bc973509ae2f034a
BLAKE2b-256 053d94c31cb2a36e24cb31d579cadc25ba47697423b5f6edc661aa4df25029db

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7eae6c7c608751ccabe8ac32ae5ea87246f9fa6012b60a98038a272982dfcead
MD5 471cb646d59977de80b4178aaf6ff2d3
BLAKE2b-256 8fce09f47a6a26b143dc687f21fa90bee08f40aa3be3a155ff729cd4fadf1948

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fd005f7f7b1528fe78e94ac2a20d4e3fc9cee79ded5b0e50319249687efcf783
MD5 0dca0c396c86074e356cac1db51bf72e
BLAKE2b-256 5711e6c96142d1cb3c907d5f1e70b5bce9ef8239b632ec267debe9f13ce06472

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 43d648fce22cf51607f220e6beb4f3dcc13cf5f00f8a85555194ae3e85df55f1
MD5 13a8d91cab0b24188fbb57baec4964d3
BLAKE2b-256 dd3212971799593c1ad2c1d354ade5b5aada81dc46e7e5865ede1b43c3ce3ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 17aafb02e06a085f4b6f3fa252a54c14c8ad4bd69d43f51ef01b600664aa6129
MD5 0850a40e79d945ed162ed96d5e075f06
BLAKE2b-256 b076da57df6323fe3d4d9e7bda173fe9f0f583bcfeed287b6d68e3b9f1930ddb

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 474ef3038a8768142ac4b21f04527baa3bd220eafd5e9186a40f8b5585437a0c
MD5 8820265a3c78c0a7732ccd0b6524cd31
BLAKE2b-256 4dd99a5a54906471e48ee8fc6ee5264f3df8651cfe85444c377e84766636ce71

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ba521c33fa838fb37068b1e9ce826ac194b8022691de1b1baa4279b97f5bbe6e
MD5 3a1634da5a1e43576bdecaecdccd708a
BLAKE2b-256 9527b063e0e564a6ccc790c38933fa369b4cf7486a48885fb2303b8521d1e368

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmbox_net_rust-1.0.1-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