Serega2780 commented on issue #745:
URL: https://github.com/apache/mina-sshd/issues/745#issuecomment-2841504585

   > With JSch or sshj, you're simply executing "show\r\n". With Apache MINA 
sshd, you're executing "interactive" and pass the command on stdin. Why?
   > 
   > What happens if you use `session.createExecChannel("show")` in the Apache 
MINA sshd version? What happens if you use "interactive" and pass the command 
on stdin in JSch or sshj?
   
   ```
                       try (ByteArrayOutputStream responseStream = new 
ByteArrayOutputStream();
                       ClientChannel channel = session.createExecChannel("""
                               show
                               """)) {
                       channel.setOut(responseStream);
                       try {
                           channel.open().verify(10, TimeUnit.SECONDS);
   //                      try (OutputStream pipedIn = channel.getInvertedIn()) 
{
   //                        pipedIn.write("show\r\n".getBytes());
   //                        pipedIn.flush();
   //                      }
   
                       var states = new 
LinkedList<>(channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED),
                               0L));
                       states.reversed().forEach(s -> log.info("STATE {}", s));
                       String responseString = new 
String(responseStream.toByteArray());
   ```
   
   Yep, with this code I'm able to receive the whole device config.
   Do you know, what "interactive" command means? I mean, that code is from the 
past. It's written already and "interactive" definitely isn't a device command. 
So I guessed it's from mina-sshd lib...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to