samdark / yii2-webshell
一个允许运行yii控制台命令并创建自己命令的web壳。
2.0.0
2016-03-04 01:01 UTC
Requires
- bower-asset/jquery.terminal: ~0.8.8
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-08-24 03:10:34 UTC
README
Web壳允许通过浏览器运行yii
控制台命令。
安装
安装此扩展的首选方式是通过composer。
运行以下命令之一
php composer.phar require --prefer-dist samdark/yii2-webshell "~2.0"
或添加
"samdark/yii2-webshell": "~2.0"
到您的composer.json
文件的require部分。
配置
要使用web壳,将其作为模块包含在应用程序配置中,如下所示
return [ 'modules' => [ 'webshell' => [ 'class' => 'samdark\webshell\Module', // 'yiiScript' => Yii::getAlias('@root'). '/yii', // adjust path to point to your ./yii script ], ], // ... other application configuration ]
使用上述配置,您将能够通过URL http://localhost/path/to/index.php?r=webshell
在浏览器中访问web壳
访问控制
默认情况下,访问受限于本地IP。可以通过allowedIPs
属性进行更改。此外,checkAccessCallback
可用于引入自定义访问控制
return [ 'modules' => [ 'webshell' => [ 'class' => 'samdark\webshell\Module', // 'yiiScript' => Yii::getAlias('@root'). '/yii', // adjust path to point to your ./yii script 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.2'], 'checkAccessCallback' => function (\yii\base\Action $action) { // return true if access is granted or false otherwise return true; } ], ], // ... other application configuration ]
限制
由于Web的请求-响应特性,Web壳无法进行交互式操作。因此,您应该禁用命令的交互模式。