Skip to content

1848431227/kgm_decoder_py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Kugou KGM/VPR 解码器(Python 版本)

许可证 语言

简介

这是一个用 Python 编写的命令行工具,用于解码酷狗音乐加密/混淆的音乐文件(如 .kgm.vpr 或缓存文件)。

这是 Rust 项目 ghtz08/kuguo-kgm-decoder 的 Python 移植版。解码原理基于原项目 README 中记录的发现,主要来自孤心浪子的博客文章ix64unlock-music 项目

注意: 本项目大部分代码逻辑都是借鉴自 ghtz08/kugou-kgm-decoder,仅将其移植到 Python 环境。

感谢 ix64 提供的用于解码的公钥。

系统要求

  • Python 3.3+(使用内置的 lzmaargparse
  • kugou_key.xz 文件(必须放置在 kgm_decoder/assets/ 目录中)

安装/设置

  1. 克隆此仓库。
  2. 确保原始 Rust 项目 src/assets 目录中的 kugou_key.xz 文件被复制到本 Python 项目的 kgm_decoder/assets/ 目录中。
  3. (可选)创建虚拟环境:
    python -m venv venv
    source venv/bin/activate  # 在 Windows 上使用 `venv\Scripts\activate`

使用方法

您可以直接使用 main.py 脚本运行解码器:

python -m kgm_decoder.main <参数>

如果您设置了入口点(例如,使用 setup.py),您可能会安装它并将其作为命令运行。

示例:

  • 解码单个文件:

    python -m kgm_decoder.main /path/to/your/song.kgm
  • 解码目录中的所有文件(非递归):

    python -m kgm_decoder.main /path/to/your/music_folder/
  • 递归解码目录及其子目录中的所有文件:

    python -m kgm_decoder.main -r /path/to/your/music_folder/

命令行选项:

参数 简写 描述
target 要处理的目标文件或文件夹
--recursive -r 递归处理文件和目录
--keep-file -k 解码后保留原始加密文件
--help -h 显示帮助信息并退出
--version 显示程序版本号并退出

注意: 解码后的输出文件将具有 .mp3 扩展名,但根据原始源,实际的音频格式可能会有所不同(例如,M4A、FLAC 等)。未来的改进可能涉及检测实际格式。

许可证

Anti 996 License Version 1.0


Kugou KGM/VPR Decoder (Python Version)

License Lang GitHub stars

Introduction

A command-line tool, written in Python, to decode encrypted/obfuscated Kugou music files (like .kgm, .vpr, or cache files).

This is a Python port of the Rust project ghtz08/kuguo-kgm-decoder. The decoding principles are based on the findings documented in the original project's README, primarily from 孤心浪子's blog post and the unlock-music project by ix64.

Note: Most of the code logic in this project is adapted from ghtz08/kugou-kgm-decoder, ported to Python environment.

Thanks to ix64 for the public key used in decoding.

Requirements

  • Python 3.3+ (uses built-in lzma and argparse)
  • The kugou_key.xz file (must be placed in kgm_decoder/assets/)

Installation / Setup

  1. Clone this repository.
  2. Ensure the kugou_key.xz file from the original Rust project's src/assets directory is copied into the kgm_decoder/assets/ directory within this Python project.
  3. (Optional) Create a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`

Usage

You can run the decoder directly using the main.py script:

python -m kgm_decoder.main <arguments>

Or, if you set up entry points (e.g., using setup.py), you might install it and run it as a command.

Examples:

  • Decode a single file:

    python -m kgm_decoder.main /path/to/your/song.kgm
  • Decode all files in a directory (non-recursive):

    python -m kgm_decoder.main /path/to/your/music_folder/
  • Decode all files in a directory and its subdirectories:

    python -m kgm_decoder.main -r /path/to/your/music_folder/

Command-line Options:

Argument Short Description
target The target file or folder to be processed
--recursive -r Process files and directories recursively
--keep-file -k Keep the original encrypted file after decoding
--help -h Show the help message and exit
--version Show program's version number and exit

Note: The decoded output file will have a .mp3 extension, but the actual audio format inside might vary (e.g., M4A, FLAC, etc.) depending on the original source. Future improvements could involve detecting the actual format.

Contributing

Contributions are welcome! Here are some ways you can contribute:

  1. Report bugs or request features by opening issues
  2. Submit pull requests to fix issues or add new features
  3. Improve documentation
  4. Share the project with others who might find it useful

License

Anti 996 License Version 1.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages