Telnet/SSH console displays "garbage"


pantner

Recommended Posts

Hey everyone,

 

I wrote a VB Script that helps me decompress downloaded files on my UNRaid server. This way I don't need to transfer the files across the network.

 

Was working perfectly until a little while ago (~2 months) when I upgraded to 6.2.4 (I was on ~5.5.0 beforehand). I have since upgraded to 6.3.2 and the problem still exists.

 

It uses a command line telnet program to open a connection and then give it commands.

 

Since the upgrade away from v5 it now shows a lot of garbage when the Telnet command is being run. As the telnet program is waiting for a specific thing to be displayed, it stops working.

ie, it is waiting for "root@Tower:-# " but it is receiving "[01;32mroot@Tower[00m:[01;34m~[00m# "

 

I've tried it in 2 clients, the one I've been using for years is called "Telnet Scripting Tool". The same thing happens in Plink.exe (bundled with Putty) and I have attached a screenshot.

However, if I log in using putty in either Telnet or SSH then that garbage doesn't come up.

 

Any ideas how to fix this?

Link to comment
it is waiting for "root@Tower:-# " but it is receiving "[01;32mroot@Tower[00m:[01;34m~[00m# "

 

Those weird characters are ANSI escape sequences used here to control the colour of text in the terminal. You'll see the effect if you telnet in manually. "[01;32m" means "start displaying in bold green". "[01;34m" means "start displaying in bold blue". "[00m" means "reset all attributes". So the sequence you give as an example displays as

 

[color=limegreen][b]root@Tower[/b][/color]:[color=blue][b]~[/b][/color]# 

 

I don't know how you would have to adjust your script to signal that it is emulating a simple monochrome terminal. Perhaps the easiest thing would be to change it to expect what is actually being sent.

Link to comment

Thanks for the reply.

 

That makes sense that it was the colour codes.

 

I couldn't find a way to turn that off, but now knowing what it was I have just added "[01;32mroot@Tower[00m:[01;34m~[00m#" into the script to wait for and it is now working.

 

I just didn't want to do that until I knew what it was.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.