# Yamaha RTXシリーズにSSHで自動的にログインして情報を取得するサンプル Python 2021-03-11 ```python= import paramiko import time user = 'username' hostname = '192.168.xxx.xxx' password = '12345678' command = '' #code = 'utf-8' code = 's-jis' port = 22 client = paramiko.SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=hostname,username=user,password=password) #command = client.invoke_shell(term="vt100", width=1024, height=1024*100) command = client.invoke_shell() command.settimeout(10) command.send("show config\n") time.sleep(1) output = command.recv(2147483647) client.close() data = output.decode(encoding=code) print(data) ``` 事前に、以下の設定を忘れずに実行する事。 ```= # console lines infinity # console columns 200 ``` ###### tags: `Yamaha RTX` `Python` `paramiko`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up