My goal is to be able to SSH into a device, execute CLI command which will take me to another Shell where I can enter in my commands. Currently, I am able to successfully SSH into a device, but cannot figure out how to get to that secondary shell with the CLI. My code below
import datetime, logging, os, paramiko, re, scp, sys, time, socket, logging
SSH = paramiko.SSHClient()
SSH.set_missing_host_key_policy(paramiko.AutoAddPolicy())
SSH.connect(server, username=usr, password=password, port=22, timeout=2)
print('successful ssh')
stdin, stdout, stderr = SSH.exec_command('cli console',bufsize=2)
# inBuf = stdout.readlines()
# for line in inBuf:
# print(line.strip('\n'))
SSH.close()
My initial assumption is that after executing the cli to get into the shell console, I would be able to just simply execute whatever command I want but that is not the case. Any help would be appreciated
Write the commands that you want to execute in the subshell to the
stdin
: