title: Get mac address with telnet in Python
body: <p>I am trying to get mac addresses from stb. When I run "ifconfig eth0 | grep HWaddr | cut -c39-55" on the command line, I get the right mac addresses.</p>
  
  <pre><code>for ip in ip_address:
  
      tel_con = telnetlib.Telnet(ip, port_number, time_delay)
      tel_con.read_until("login: ")
      tel_con.write(user_name + "\r\n")
      tel_con.read_until("-sh-3.2#")
      tel_con.write("ifconfig eth0 | grep HWaddr | cut -c39-55\r\n")
      mac_addresses.append(tel_con)
  
      print tel_con
  </code></pre>
  
  <p>However, when I run the command from my python script, the output is in the different format. </p>
  
  <pre><code>&lt;telnetlib.Telnet instance at 0x02760D50&gt;
  &lt;telnetlib.Telnet instance at 0x02760DC8&gt;
  &lt;telnetlib.Telnet instance at 0x02760EB8&gt;
  &lt;telnetlib.Telnet instance at 0x02760FD0&gt;
  &lt;telnetlib.Telnet instance at 0x02762120&gt;
  &lt;telnetlib.Telnet instance at 0x02762238&gt;
  &lt;telnetlib.Telnet instance at 0x02762350&gt;
  &lt;telnetlib.Telnet instance at 0x02762468&gt;
  </code></pre>
  
  <p>Any helps would be appreciated.</p>