如何创建匿名 Python telnet 连接?
我正在尝试在 Windows XP 上使用 Python 远程登录到服务器。 我可以通过键入“telnet HOST PORT”来成功连接,这将创建一个匿名连接。 但Python的telnetlib.Telnet(HOST, PORT)返回“连接被拒绝”。 Java 中的 Telnet 也失败。 Spelunking 显示 Python 尝试创建匿名套接字连接。 我的管理员说他不允许匿名连接。 但是Python和Java都不允许在套接字连接创建期间传入身份验证参数(我找不到)。 为什么 Windows 的命令行 telnet 可以工作,而 Python 和 Java 都失败了? 有什么建议吗?
I am trying to telnet into a server using Python on Windows XP. I can connect successfully by typing 'telnet HOST PORT' which creates an anonymous connection. But Python's telnetlib.Telnet(HOST, PORT) returns 'Connection refused'. Telnetting in Java also fails. Spelunking shows that Python tries to create an anonymous socket connection. My admin says he doesn't allow anonymous connections. But neither Python nor Java allow authentication parameters to be passed in during socket connection creation (not that I could find). Why does Windows' command-line telnet work when Python and Java both fail? Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好使用 wireshark 跟踪连接尝试(失败案例和成功案例)或类似的数据包跟踪工具可以查看协议级别的差异。
It would be a good idea to trace both connection attempts (a failing case and a successful case) with wireshark or similar packet trace tool to see what the difference is at the protocol level.
首先,消除 telnetlib 作为您的问题:
If that succeeds, there is a problem in your usage of
telnetlib
, and we'll need to see an example. If it fails, then you have a basic networking problem, and Lance's suggestion of pulling out ethereal/wireshark is your next step.First, eliminate telnetlib as your problem:
If that succeeds, there is a problem in your usage of
telnetlib
, and we'll need to see an example. If it fails, then you have a basic networking problem, and Lance's suggestion of pulling out ethereal/wireshark is your next step.