关闭远程Windows机器

时间:2015-09-06 00:18:20

标签: lua telnet shutdown luasocket

我正在寻找一种使用Lua远程关闭Windows 7或8机器的方法。我可以通过OS X中的终端或Windows中的cmd提示成功使用Telnet,这样我就知道远程计算机上的telnet服务器正在运行,登录凭据有效,我的命令正确。

也许我试图发送这样的登录信息走错了路,但这里是我一直在修补的东西:

local socket = require("socket")
conn = socket.tcp() 
conn:connect("10.0.1.15",23) -- the remote machine I want to shutdown
socket.sleep(3)
conn:send("GrandMA2 onPC\r\n") -- the user name
socket.sleep(3)
conn:send("password\r\n") -- the password
socket.sleep(3)
conn:send("shutdown -r -f\r\n") -- the shutdown/restart command
socket.sleep(3)

我尝试了各种睡眠时间组合,\ r,\ n等等。当使用Wireshark来监控Telnet连接时,我可以清楚地看到我没有得到我期望从telnet服务器得到的响应(就像我在使用cmd提示符或终端时那样)。

非常感谢任何帮助。

0 个答案:

没有答案
相关问题