![]() ![]() Outfile = open(outfilepath ipaddr "_" time_now, "w") Stdin, stdout, stderr = ssh.exec_command('show run') Ssh.connect(hostname=ipaddr, username=user, password=secret, port=port) # loop through device list and execute commands Input_file = open( infilepath devicelist, "r") Outfilepath = "c:\\Users\\johnk\\Downloads\\" Ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # import modules needed and set up ssh connection parameters ![]() ![]() Cisco config backup Python script # Backup Cisco config I have an explanation of each line after the code. Python ignores white space, but it makes it easier to read and understand. I have added comments and broken them into sections, separating the lines with a line of white space. Much of this was used in the previous script. Now, let us have a look at the script we will use. ![]()
0 Comments
Leave a Reply. |