
glaucoperucchi
(usa Debian)
Enviado em 03/03/2017 - 09:35h
Bom dia pessoal,
Estou tentando criar um script em python2.7 para salvar as configurações dos Switchs HPN, mas estou com problema na execução do mesmo.
Após botar a senha do comando super admin do Switch, o comando save não executa, para nesta linha stdin.write('save\n').
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username='admin', password='123456')
stdin, stdout, stderr = ssh.exec_command("_cmdline-mode on")
stdin.write('Y\n')
stdin.write('Jinhua1920unauthorized\n')
stdin.write('save\n')
stdin.write('Y\n')
stdin.write('\n')
stdin.write('Y\n')
Resultado do comando:
******************************************************************************
* Copyright (c) 2010-2016 Hewlett-Packard Development Company, L.P. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<SW 01>
All commands can be displayed and executed. Continue? [Y/N]Y
Please input password:**********************
Warning: Now you enter an all-command mode for developer's testing, some commands may affect operation by wrong use, please carefully use it with our engineer's direction.
<SW 01>
[]
Alguém sabe como posso executar outro comando após logar no Switch com a linha stdin, stdout, stderr = ssh.exec_command("_cmdline-mode on")??
Obrigado!