In my previous blog entry, I found a tool MultiCom that proxies my serial to a TCP socket, but it was lacking the ability to set my telnet client into character mode and wasn’t working with Cisco devices.

I later found out this was because Telent sends CR + NULL everytime you hit ENTER, so this happens:

Username: (type username) CR
Password: NULL (type password)

I couldn’t log in! I am curious why other devices ignored the NULL while Cisco choose to process it. Not as if NULL would be used as part of a password.

So, I got my script to work. Theoretically this script should work on any UNIX system and on any type of FIFO, but I’ve only had time to test it on the Mac and a serial cable.

Download the script here. Rename it to script.py and then chmod 755 script.py.

Here’s how to use it.

Start the script in one terminal window. /dev/cu.PL2303-0000101D is your serial device. You may choose to run it in the background by suffixing a “&” after the command.

$ ./serial.py /dev/cu.PL2303-0000101D
Serial to Telnet Proxy  Copyright (C) 2009  Justin Lee
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. For details, see the
full license at http://www.gnu.org/licenses/gpl-3.0.html

Listening on 127.0.0.1:2300.

Once it’s ready, it will listen on port 2300 (the default). Open another window and telnet to this port on your localhost.

$ telnet localhost 2300
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

User Access Verification

Username: cisco
Password: 

lab>?
Exec commands:
  access-enable    Create a temporary Access-List entry
  clear            Reset functions
  connect          Open a terminal connection
  disable          Turn off privileged commands
  disconnect       Disconnect an existing network connection
  enable           Turn on privileged commands

I’ve tested it with a Cisco switch and some other appliances and they work OK. Let me know if you encounter any bugs.