Answer the question
In order to leave comments, you need to log in
How to put a mac list into a variable?
Help me edit the script please, I'm trying to get a list of mac addresses placed in 1 variable (bash or python, not better) mac_list and then substituted into the arp command but does not exit.
Here is the code:
import paramiko
import os
HOST = "192.168.3.6"
ssh_client = paramiko.SSHClient()
#Add missing client key
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
#connection
ssh_client.connect(HOST,username='root', password='passswd')
os.system("export mac_list='mac1\|mac2\|mac3'")
os.environ['mac_list']
os.system('echo $mac_list')
print('$mac_list')
tdin, stdout, stderr = ssh_client.exec_command('arp -an|$mac_list')
print(stdout.read())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question