ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.62k stars 1.31k forks source link

lrzsz not support? #2480

Closed songtianyi closed 2 years ago

songtianyi commented 3 years ago

Like i'm running sz in remote host which connected with ssh, how to receive the payload in netmiko?

Generally, a wizard in localhost will prompt to choose a file to save to, but what i want is save this file in netmiko silently

from netmiko import ConnectHandler
from getpass import getpass

cisco1 = {
    "device_type": "autodetect",
    "host": "10.88.88.240",
    "username": "administrator",
    "password": getpass(),
}

# Show command that we execute.
command = "new  export config.log encrypt  off"

with ConnectHandler(**cisco1) as net_connect:
    output = net_connect.send_command(command)

# Automatically cleans-up the output so that only the show output is returned
print()
print(output)
print()

The command new export config.log encrypt off is mostly like sz, because i saw the zmodem start flag bytes in output.

rz^M**^XB00000000000000^M<8a>^Q
ktbyers commented 3 years ago

@songtianyi You are going to have to repeat and expand on your question here? I don't understand what you are asking.

Your code above is not valid i.e. that is not a valid way to use autodetect, you could try generic instead and see if that works (or not).