Notifications
Clear all
Topic starter
Engineers need to collect the running status of existing network equipment. Currently, there is a Huawei CE12800 switch with an SSH server configured on the live network. The authentication method is username and password authentication. The device information is IP address: 192.168.1.1, SSH username: huawei, SSH password: 123456, and SSH slogan: 22.
Engineers need SSH to log in to the switch to check the memory usage of the device. Which of the following Python codes can implement this function? (Multiple Choice)
- A . import paramiko
Client = paramiko.client.SSHClient()
Client.connect(hostname='192.168.1.1', username='huawei', password='123456')
stdin, stdout, stderr = client.exec_command('display memory')
print(stdout)
Client.close()
B. import paramiko
Client = paramiko.Transport(('192.168, 1.1', 22)
Client.connect(username='huawei', password='123456')
Cli = client.inv ker_she11()
Cli.send('display memory
')
Dis = clli.recv(999999).dec de()
Cli.cl se()
C. imp rt paramiko
Client = paramiko.Transp rt(('192.168.1.1', 22)
Client.connect(username='huawei', passw rd='123456')
stdin, stdout, stderr = client.exec_command('display memory')
Result=std ut.resd()
For line in result:
Print(line)
Ssh.close()
D. import paramiko
Client = paramiko.client.SSHClient()
Client.connect(h stname='192.168.1.1', username='huawei', password='123456')
Cli = client.inv ker_she11()
Cli.send('display memory
')
Dis = clli.recv(999999).dec de()
Print(dis)
Cli.close()
Suggested Answer: CD
Posted : 27/10/2022 11:11 am