【发布时间】:2021-08-21 05:09:36
【问题描述】:
如何在 python 脚本中使用 telnet 检查远程 PC 的状态?
【问题讨论】:
-
不妨看看
nmap。
标签: python python-3.x telnet
如何在 python 脚本中使用 telnet 检查远程 PC 的状态?
【问题讨论】:
nmap。
标签: python python-3.x telnet
如果一定要telnet,可以使用内置的telnetlib:
from socketlib import timeout
from telnetlib import Telnet
try:
Telnet("example.com", 23, 5) # Timeout duration is 5 seconds
print("Connected")
except timeout:
print("Timed out")
【讨论】: