Skip to main content

Python SDK for Codexus OpenSDK - Third-party Minecraft launcher

Project description

Codexus Python SDK

C# Codexus.OpenSDK 的 Python 移植版本,用于网易 Minecraft (X19) 的第三方登录和启动。

功能特性

  • ✅ 4399 账号密码登录
  • ✅ X19 认证流程 (LoginOtp -> AuthenticationOtp)
  • ✅ HTTP AES 加密/解密 (HttpCipher)
  • ✅ 动态令牌计算 (DynamicToken)
  • ✅ SKIP32 加密 (Skip32Cipher)
  • ✅ 完整的类型注解和数据模型

安装

# 方式1: 直接安装
pip install codexus-sdk

# 方式2: 从源码安装
git clone https://github.com/your-repo/codexus-sdk.git
cd codexus-sdk
pip install -e .

依赖:

  • requests >= 2.28.0
  • cryptography >= 37.0.0

使用示例

from codexussdk import MgbSdk

# 创建 SDK 实例
sdk = MgbSdk(x19_version="1.1.0")

# 登录
result = sdk.login("your_username", "your_password")
if result.success:
    print(f"登录成功: {result.username}")
    
    # 获取游戏令牌
    token = sdk.get_game_token()
    print(f"游戏令牌: {token}")
    
    # 构建启动参数
    params = sdk.build_launch_parameters(
        server_address="mc.example.com",
        server_port=25565,
        player_name="PlayerName",
        version="1.20.1"
    )
    print(f"启动参数: {params}")
else:
    print(f"登录失败: {result.message}")

# 释放资源
sdk.close()

模块说明

模块 说明
codexussdk.cipher 加密解密工具 (HttpCipher, DynamicToken, Skip32Cipher)
codexussdk.http_client HTTP 客户端封装
codexussdk.entities 数据模型 (LoginResult, X19AuthDetail, MPayUser 等)
codexussdk.c4399 4399 登录实现
codexussdk.x19 X19 认证实现
codexussdk.mgb_sdk MGB SDK 主入口

文件结构

codexussdk/
├── __init__.py      # 包入口,导出所有公共 API
├── cipher.py        # 加密模块
├── http_client.py   # HTTP 客户端
├── entities.py      # 数据模型
├── c4399.py         # 4399 登录
├── x19.py           # X19 认证
├── mgb_sdk.py       # SDK 主类
├── example.py       # 使用示例
├── setup.py         # 安装配置
├── pyproject.toml   # 现代 Python 包配置
├── requirements.txt # 依赖列表
├── README.md        # 说明文档
└── tests/           # 单元测试
    ├── __init__.py
    ├── test_cipher.py
    └── test_sdk.py

注意事项

  1. 本 SDK 为 C# 版本的 Python 移植,部分实现可能因语言差异而简化
  2. X19 认证流程涉及加密通信,实际使用时需要确保网络环境正常
  3. 4399 登录可能需要验证码,请根据返回结果处理

许可证

GPL 3.0 (与原始 C# SDK 保持一致)

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

codexus_sdk-1.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

codexus_sdk-1.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file codexus_sdk-1.1.0.tar.gz.

File metadata

  • Download URL: codexus_sdk-1.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for codexus_sdk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 120c98ff17159a45bc9362cc413ea7d47470d11ca24b556cdbe0458e050f2a1a
MD5 f25faedcb06214b6dc1930a2331f037b
BLAKE2b-256 d0de0901144f26993672fc54550c631ecf4934b8823e30e11edcbb2467a5932a

See more details on using hashes here.

File details

Details for the file codexus_sdk-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: codexus_sdk-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for codexus_sdk-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2ac963899b2a803eade3f833194fc14302848deabba2c18eceddd669e08511
MD5 950b1de998d6e2c293d29dfd3399b08b
BLAKE2b-256 15fa1053941885a620a9839449cd4bd3ddfb2d73d1b797a149702df70bb8c3f9

See more details on using hashes here.

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