I need to connect to a remote server via telnet. To authenticate to the server I have to answer like a 100 questions. So I tried to automate this task in python using telnetlib but the prompt halts without returning any message.
here is what I did
import telnetlib 
port = 2002
host = "23.23.190.204"
tn = telnetlib.Telnet(host, port)
tn.read_until("""
Welcome to EULER!
                 =================
                                  Answer 100 simple questions to authenticate yourself
""")
print tn.read_all()
tn.close()
in the command line prompt I get this message
Welcome to EULER!
=================
Answer 100 simple questions to authenticate yourself
then I am getting asked a question if the answer is correct I get the next question till I finished the 100. But in the python program I not getting neither the message nor the questions! what to do?
EDIT:
after setting the debug level for telnet, I get the answer of the server. Could you please explain why is that?
tn.set_debuglevel(9)
				
                        
This is a fake telnet server using netcat (
ncatfrom Nmap):listing on port 9000 and passes a file named
msg.txt(the questions) and log the input intolog.txt(the answers), it should simulate your server.The file
msg.txtcontent:the file content in hex (using
hexdump msg.txt):notice the new line character, it's
\x0Aor\n(it can also be\x0D\x0Aor\n\r).The client:
now lets test it, on the client side:
on the server side, dump the log file content:
put it together you should get the idea.