Skip to main content
NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-system-command

✨ Call the system command-line in NoneBot2 ✨

license pypi python nonebot
  • 以发送消息的方式操作Bot所在环境的系统命令行
  • 甚至可以通过此插件 rm 整个服务器
  • 限超级用户使用

💿 安装

nb-cli安装, 包管理器安装 二选一

使用 nb-cli 安装

在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

nb plugin install nonebot-plugin-system-command
使用包管理器安装

在 nonebot2 项目的插件目录下, 打开命令行,

根据你使用的包管理器, 输入相应的安装命令

pip
pip install nonebot-plugin-system-command
pdm
pdm add nonebot-plugin-system-command
poetry
poetry add nonebot-plugin-system-command
conda
conda install nonebot-plugin-system-command

打开 bot项目下的 pyproject.toml 文件,

在其 plugins 里加入 nonebot_plugin_system_command

plugins = ["nonebot_plugin_system_command"]

🎉 使用

  • 可在 Bot项目的 .env* 中自定义调用命令行的指令, 默认值为 /sh 和 /cmd

  • 如果 .env* 中 COMMAND_START 变量值为 ["/"] 那么指令应该为 //sh //cmd

SYS_CMD_SH="/sh"
SYS_CMD_CMD="/cmd"

指令表

指令 权限 需要@ 范围 特性 说明
/sh 主人 否 私聊 | 群聊 异步管道 Windows环境无法正常使用
/cmd 主人 否 私聊 | 群聊 同步管道 通用

语法

命令行语法与Bot运行环境相关, 与插件指令无关

  • bash 运行即使用 bash 语法
  • zsh 运行即使用 zsh 语法
  • powershell 运行即使用 powershell 语法
  • cmd 运行即使用 cmd 语法

其他shell同理

⚠️ ATTENTION

  • 当您使用本插件时, 我们默认您了解命令行的基本使用, 以及在 根环境 运行命令的危险性;
  • 在使用本插件前请先确认没有其他插件与本插件的指令发生冲突, 如有, 请在Bot项目下的 .env* 文件里自定义本插件的响应指令;
  • 如有因为此插件响应了不相干的消息, 导致设备遭到损坏, 将由使用者自己承担相关责任.

注: 此处的 根环境 是指以 root 或者 管理员(Administrator) 或者其他高权限运行的终端环境

示例

/sh echo "hello world"
/cmd echo "hello world"

效果图

01.png

TODO

  • 使用异步管道
  • 命令行交互

⚠️ ATTENTION

Don't drink and root! 🍻

Metadata

Release files for nonebot-plugin-system-command 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-system-command 0.1.5
File Size Uploaded Provenance
nonebot_plugin_system_command-0.1.5.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-system-command 0.1.5
File Interpreter ABI Platform
nonebot_plugin_system_command-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / nonebot_plugin_system_command-0.1.5.tar.gz

Download URL nonebot_plugin_system_command-0.1.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e65ed950c2679872140c1cce67584731111ed197b1ae5e88773d617affb63080
BLAKE2b-256 checksum
How to use checksums
8f1343bfaf18b9f88a59fae127dfc0fd54615e3f45e94c8d6e5cfd1130041618
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / nonebot_plugin_system_command-0.1.5-py3-none-any.whl

Download URL nonebot_plugin_system_command-0.1.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
354b85e92e1e8eccb53c0bd32a8528063093abfca9a48c156ff4e3f005e3caa6
BLAKE2b-256 checksum
How to use checksums
d840fe8d6ee3b4177a62ea4c77cd19b65fd44fcfabe3eeb517d90ca2288cb59c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for nonebot-plugin-system-command 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page