I got some unrecognised character in the output stream while connecting network device using SSH, But when I connect through putty, it shows a blank area instead of those unrecognised characters? Can someone help me with this? I am using “j2ssh-maverick1.5.2” library to connect the device through SSH.
Output stream output:
HP J9eA 2522-24G Switch
Software revision YA.15.13.0005
Copyright (C) 1991-2014 Hewlett-Packard Development Company, L.P.
RESTRICTED RIGHTS LEGEND
Confidential computer software. Valid license from HP required for possession,
use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer
Software, Computer Software Documentation, and Technical Data for Commercial
Items are licensed to the U.S. Government under vendor's standard commercial
license.
HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
20555 State Highway 249, Houston, TX 77070
[1;15r[1;1H[44;1HPress any key to continue[15;1H[?25h[300;27H[?6l[1;300r[?7l[2J[1;1H[1920;1920H[6n[1;1HYour previous successful login (as manager) was on 1990-01-26 15:59:52
from 10.30.222.231
[1;44r[300;1H[44;1H[2K[300;1H[?25h[300;1H[44;1HHP-2522-24G# [300;1H[44;14H[300;1H[?25h[300;14H
Putty output
Copyright (C) 1991-2014 Hewlett-Packard Development Company, L.P.
RESTRICTED RIGHTS LEGEND
Confidential computer software. Valid license from HP required for possession,
use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer
Software, Computer Software Documentation, and Technical Data for Commercial
Items are licensed to the U.S. Government under vendor's standard commercial
license.
HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
20555 State Highway 249, Houston, TX 77070
Press any key to continue
Your previous successful login (as manager) was on 1990-01-26 15:14:36
from 10.30.222.231
HP-2522-24G#
Advertisement
Answer
These are character control sequences from a terminal.
When you created your SshSession, you likely requested a pseudo-terminal using the requestPseudoTerminal API call.
If you don’t need to hook the output of the session up to a terminal emulator, then the best course of action is to use a dumb terminal.
session.requestPseudoTerminal("dumb", 80, 25, 0, 0);
If that does not work you will have to omit the pseudo-terminal request altogether.