Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:57:33+00:00 2026-06-11T09:57:33+00:00

Hi I known that I should send ‘IAC DONT ECHO’ message, but how may

  • 0

Hi I known that I should send ‘IAC DONT ECHO’ message, but how may I do that using telnetlib??
Here is my test, but it doesn’t work.

 #!/usr/bin/env python2
 u"""test"""
 # -*- coding: utf-8 -*-

 import sys
 import telnetlib
 import time

 HOST = "10.10.5.1"
 tn = telnetlib.Telnet(HOST, timeout=1)
 tn.read_until("login: ")
 tn.write("login\n")
 tn.read_until("Password: ")
 tn.write("pass\n")

 print "###########"
 time.sleep(0.5)
 print tn.read_very_eager()

 tn.write("ls /\n")
 time.sleep(0.5)
 print tn.read_very_eager()

 # diable echo here
 tn.write(telnetlib.IAC + "\n")
 tn.write(telnetlib.DONT + " " + telnetlib.ECHO + "\n")
 time.sleep(0.5)
 print tn.read_very_eager()

 tn.write("ls /\n")
 time.sleep(0.5)
 print tn.read_very_eager()

 print "########### exit"
 tn.write("exit\n")
 print tn.read_all()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:57:34+00:00Added an answer on June 11, 2026 at 9:57 am

    You are sending the sequence wrong:

    # diable echo here
    tn.write(telnetlib.IAC + "\n")
    tn.write(telnetlib.DONT + " " + telnetlib.ECHO + "\n")
    

    THE IAC DONT ECHO is sent as three bytes, without any padding, spaces or newlines. So try this instead:

    tn.write(telnetlib.IAC + telnetlib.DONT + telnetlib.ECHO)
    

    However, it might not be enough to turn off echo actually. The solution most commonly used is actually to say that you will do the echoing, which will make the other end stop doing echoing:

    tn.write(telnetlib.IAC + telnetlib.WILL + telnetlib.ECHO)
    

    Edit: After reading the telnetlib manual page I see that the write function will:

    Write a string to the socket, doubling any IAC characters.

    So using the Telnet object write function will not work sending these sequences, you have to get the socket and use that to write the sequence:

    def write_raw_sequence(tn, seq):
        sock = tn.get_socket()
        if sock is not None:
            sock.send(seq)
    
    write_raw_sequence(tn, telnetlib.IAC + telnetlib.WILL + telnetlib.ECHO)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scala programmer should have known that this sort of writing : class Person{ var
I know that I should put all the html elements in body tag, but
I know that I should setup the trap service on each devices seperately but
this is my first question here :) I know that I should not check
I have a PhoneGap application that works fine but occasionally is known to have
Why was it decided that using XMLHTTPRequest for doing XML calls should not do
So, I have this link, that should send an AJAX request everytime it is
Here is the code of program, which should send a simple 'ping'. I know
I know that we should only create repositories for Aggregate Roots and not for
I know that I should have schema of a table before calling NewRow method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.