| 关键词: ReadComputerName WScript misswe Echo TSName vbsEcho 端口 方法 TSRegPath CurrentControlSe |
利用CMDshell查看3389端口VBS方法,很多时候服务器3389端口已经被更改,大家不妨用这个方法来查看一下,使用方法,完全复制,粘贴到cmd上,回车即可! 有些shell 没有权限读取注册表,我们可以利用以下方法读取.... Echo Dim ReadComputerName >>misswe.vbsEcho Set ReadComputerName=WScript.CreateObject("WScript.Shell") >>misswe.vbsEcho Dim TSName,TSRegPath >>misswe.vbsEcho TSRegPath="HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber" >>misswe.vbsEcho TSName=ReadComputerName.RegRead(TSRegPath) >>misswe.vbsEcho WScript.Echo("TermService port is:"^&TSName) >>misswe.vbsCscript misswe.vbs 方法1 : VBS 版 Dim ReadComputerName Set ReadComputerName=WScript.CreateObject("WScript.Shell") Dim TSName,TSRegPathTSRegPath="HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber" TSName=ReadComputerName.RegRead(TSRegPath)WScript.Echo("终端端口为:"&TSName)WScript.Echo将以上内容保存后缀名为VBS即可 。 方法2 :bat 版@echo offmode con cols=32 lines=6for /f "skip=4 tokens=1,2 delims=x" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber"') do (set pnL=%%aset pnR=%%b)set /a pn=%pnL:~-1%x%pnR%echo. & echo 你的终端端口为 : %pn%echo. & echo 按任意键退出 & pause>nul |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|