【发布时间】:2020-06-05 21:38:29
【问题描述】:
我需要在客户端单击按钮时从客户端计算机运行 powershell 脚本,使用 XAMPP 托管网站并将所有必需的文件放在 htdocs 文件夹中,
<form action="site.php" method="post">
<input type="submit" name="getprocess" class="btn btn-default" value="Prototype"/>
</form> </li>
<?php
if(array_key_exists('getprocess', $_POST)) {
GetProcess();
}
function GetProcess() {
echo Shell_Exec ('powershell.exe -executionpolicy bypass -NoProfile -File ".\myscript.ps1"');
//echo Shell_Exec ('powershell.exe -executionpolicy bypass -NoProfile -Command "Get-Process | ConvertTo-Html"');
}
但是如果我们从客户端单击原型按钮,脚本正在网络服务器上运行,如果需要修改任何内容以使脚本直接从客户端计算机运行,请建议我
【问题讨论】:
-
简短的回答,你不能从一个网站。那将是一个巨大的安全漏洞。你可以提供一些东西让他们下载然后执行,但希望大多数人甚至不会考虑这样做。
标签: javascript php html powershell xampp