How do you create an anonymous Python telnet connection?

I am trying to connect to a server using Python on Windows XP. I can connect successfully by typing "telnet HOST PORT" which creates an anonymous connection. But Python telnetlib.Telnet (HOST, PORT) returns "Connection refused". Telnetting in Java also fails. Spelunking shows that Python is trying to create an anonymous socket connection. My admin says it doesn't allow anonymous connections. But neither Python nor Java allows authentication parameters to be passed during socket creation (not what I could find). Why does Windows telnet command work when Python and Java don't work? Any advice?

+1


a source to share


2 answers


It would be nice to trace both the connection attempts (failed and successful) with wireshark or a similar packet to see what the difference is at the protocol level.



+1


a source


First, eliminate telnetlib as your problem:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("remote.host", 23))
      



If this succeeds, there is a usability problem telnetlib

and we will need to see an example. If it fails, you have an underlying network problem, and Lance's suggestion for withdrawing ether / wireshark is your next step.
+1


a source







All Articles