MBS Network Plugin - SSH Encoding Q

Hello,

I noticed that a set of network devices has some weird ASCII in the results I pull from the socket that I am not familiar with using other network devices.

Any ideas?

this is the method that retrieves my data:

  Dim i as integer
  do
    Dim ReceiveBufferArray() as String
    app.SleepCurrentThread ms
    
     ReceiveBuffer = ConvertEncoding(SSHChannel.Read, Encodings.ASCII) // Have tried no encoding and UTF-8 all the same
    
    IF LogModule.LogLevel = 1 Then
      for i  = 0 to UBound(ReceiveBufferArray)
        LogModule.mLiveLog(ReceiveBufferArray(i))
      next i
    END IF
    
  loop until SSHChannel.Read = ""

This screen shot is live directly after it receives data from the ssh.read:

See Line Number 2:

It is possible that they are control codes for doing things like clearing the screen. If you use a regular ssh client to connect, and you issue the same command, does it do a screen clear, or use any other “visual goodies”?

Ironically when you ssh manually the second line that has the ascii should say “Arista vEOS”

They are xterm escape sequences:
The first one sets the cursor key mode:

CSI ? Pm h DEC Private Mode Set (DECSET). Ps = 1 -> Application Cursor Keys (DECCKM).

The second one switches it back to normal:

CSI ? Pm l DEC Private Mode Reset (DECRST). Ps = 1 -> Normal Cursor Keys (DECCKM).

Sorry I missed a part of the second one:

The bracket K does an erase on the line.

CSI Ps K Erase in Line (EL). Ps = 0 -> Erase to Right (default). Ps = 1 -> Erase to Left. Ps = 2 -> Erase All.

Illegal use of ConvertEncoding. Use DefineEncoding. Converting a bad/unknown encoding will only further mangle your data.

ReceiveBuffer = DefineEncoding(SSHChannel.Read, Encodings.UTF8)

[quote=171869:@Tim Hare]Illegal use of ConvertEncoding. Use DefineEncoding. Converting a bad/unknown encoding will only further mangle your data.

ReceiveBuffer = DefineEncoding(SSHChannel.Read, Encodings.UTF8) [/quote]

Thank you Tim. Bob it also appears that I am having a SSH session terminal issue. Thank you for uncovering that also!!!

So everything working now?
Sorry for coming late to the discussion.

So here was the fix.

Changing my SSHChannel.RequestPTY from “xterm” to “XTERM” fixed my issue

Tim helped me fix my code properly and Bob pointed me to SSH terminal emulation.

Thanks team!!!