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

注意:在代码中导入时请使用 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.0.tar.gz (655.4 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.0-cp39-abi3-win_amd64.whl (200.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

kmbox_net_rust-1.0.0-cp39-abi3-win32.whl (186.1 kB view details)

Uploaded CPython 3.9+Windows x86

kmbox_net_rust-1.0.0-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.0-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.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (502.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

kmbox_net_rust-1.0.0-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.0-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.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (358.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

kmbox_net_rust-1.0.0-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.0-cp39-abi3-macosx_10_12_x86_64.whl (316.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: kmbox_net_rust-1.0.0.tar.gz
  • Upload date:
  • Size: 655.4 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.0.tar.gz
Algorithm Hash digest
SHA256 bfbe5ce4c03cdfb651effa8bd06a3f12c2f64945e766b33155ebf529f6c2bd4c
MD5 9cef0a80ff0cf84fc14eb32f8c7f563d
BLAKE2b-256 4e13ab508c86c1b926d08f99a5adb38765d15b13b2b09c11496d4ecb7ac52cf6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0159ddf86b4777f571fad7b767794da384620be0823941a6beb964ffa474e9cc
MD5 069b9b36c942fa7b4d71f0a25299fccb
BLAKE2b-256 2642390c7481919c81b5861a975365adc37f1ca62e3a19187890cd392ff269ec

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kmbox_net_rust-1.0.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 186.1 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.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 82a0b85f576f2f82277348e5721f34d39d162552ba0610148cce757bce3f3668
MD5 790e62058b059de0dfe1d0e46cdd473d
BLAKE2b-256 93c25ffba25c850f55c139aa547c9f500e68d3df2987f1a13f5d113f25b59df1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 974e5151db2b1a148ab8f1936abce9f1b3faa51326dbeace026bfd0291af088b
MD5 128298d0f6dc489cbf78ed735b2f2e3e
BLAKE2b-256 6dfcb8595eb9ceda1063264cfc2952341bc75ad4039db4eac253c9390a83b9c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 6c512a2cd3784617ad74a7ad9eafa17d521110e39e8d88df80c862482ad7c03f
MD5 51d0bad4d83da95c51a434ab6555a6bf
BLAKE2b-256 e3bb995c8b4124e49835a9666176c3d8934b77feb6d05f9dd208cb899b16845a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 26641532147313a68d15aa315fd7ffef8f1dccc48a1bcc9a4116d52cad736993
MD5 f940d8cff14f3cc7cdeed9946bf27221
BLAKE2b-256 be4613837e08af36d866c21f8223ef144a896219c91804553042424d093df446

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5a2c4b922ce4aedf47a96cc732638d1e084f40764dabf2ad72f3fcd39b2520e5
MD5 75177ca3c73121f68cff51ca788acc8b
BLAKE2b-256 2a9ab6e4788579feb55211c26fe048ba0e3c7276b450a286b15155c21a03f140

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c258f408a8b00da987dc26baa1c5d5a6a7670cfb126d34d311b64962fa89f2c0
MD5 1ba61512c3be2f221647bf68245021e9
BLAKE2b-256 93532c24798c9f58f4dda9e3d16a44cc456b5d70ed01f1ee5b597498b633d205

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 16b832ac1240d3efc2fd2aa32da464b097f0c55e2fc5e3e085584252cdb81054
MD5 7569b16fc04b69edeab582585c0bcb4d
BLAKE2b-256 42641ea82cd7b831a89d1cb9708c0fe8f3ed4273ab31951fc85f982523c76286

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6995427563de89ef70764c779b524ab71bc79e742e76bd176e49f7c96dc9099d
MD5 d23cf7574ab78bbdb02ff9788c03ceeb
BLAKE2b-256 7f2f20cd94155c4548634b4a6101701f2394d1eb0460c9636543de8c249c5e02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kmbox_net_rust-1.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a04bd89b1bb850a4e248aa675e529e70d27158b1944e0dfcb086bbf5d447b589
MD5 bf5b152012dafec657136c5c33220cd0
BLAKE2b-256 97e86a5d0f6740d1fec5f91b426ce41da7b6ff2ad032db22748faf1dc464dd3f

See more details on using hashes here.

Provenance

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