Base64 编解码工具,支持编码/解码文本、JSON、二进制文件,自动检测格式,支持批量处理
一个功能完整的 Base64 编解码工具,支持文本、JSON、二进制文件的处理。
# 解码
python3 scripts/base64_tool.py decode "SGVsbG8gV29ybGQ="
# 输出: {"success": true, "type": "text", "content": "Hello World", ...}
# 编码
python3 scripts/base64_tool.py encode "Hello World"
# 输出: {"success": true, "encoded": "SGVsbG8gV29ybGQ=", ...}
# 检测类型
python3 scripts/base64_tool.py detect "eyJ0ZXN0IjogMX0="
# 输出: {"type": "json", "content": {"test": 1}, ...}
# 基本解码
python3 scripts/base64_tool.py decode "SGVsbG8="
# 从文件读取
python3 scripts/base64_tool.py decode --file encoded.txt
# 保存到文件
python3 scripts/base64_tool.py decode "iVBORw0KGgo..." --output image.png
# 强制二进制模式
python3 scripts/base64_tool.py decode "..." --binary
# 编码文本
python3 scripts/base64_tool.py encode "Hello World"
# 编码文件
python3 scripts/base64_tool.py encode --file document.pdf
# URL 安全编码
python3 scripts/base64_tool.py encode "Hello+World" --url-safe
# 检测内容类型
python3 scripts/base64_tool.py detect "eyJ0ZXN0IjogMX0="
支持检测的类型:
json - JSON 数据text - 纯文本image/png, image/jpeg, image/gif - 图片application/pdf - PDF 文档application/zip - ZIP 压缩包application/gzip - Gzip 压缩binary - 其他二进制# 批量解码(每行一个 Base64)
python3 scripts/base64_tool.py batch --file list.txt
# 批量解码并保存到目录
python3 scripts/base64_tool.py batch --file list.txt --output-dir ./decoded/
所有命令输出 JSON 格式:
{
"success": true,
"operation": "decode",
"type": "json",
"mime_type": "application/json",
"content": {"key": "value"},
"raw_size": 16,
"message": "Successfully decoded as JSON"
}
| 场景 | 命令 |
|------|------|
| 解析 JWT Token | decode <jwt_payload> |
| 查看 K8s Secret | decode <secret_data> |
| 编码配置文件 | encode --file config.json |
| 提取 Data URI 图片 | decode <base64_part> --output image.png |
| 批量处理日志 | batch --file logs.txt |
base64 模块-_ 转换为 +/)base64-parser/
├── SKILL.md # 技能定义
├── README.md # 本文档
└── scripts/
└── base64_tool.py # 主程序
Edit PDFs with natural-language instructions using the nano-pdf CLI.
Control Sonos speakers (discover/status/play/volume/group).
Terminal Spotify playback/search via spogo (preferred) or spotify_player.
Capture frames or clips from RTSP/ONVIF cameras.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.
Category:tools