'ifconfig' + interface + 'down'
Is not spaced and will produce a single long word ifconfigwlan0down
instead of the desired ifconfig wlan0 down
you have two aproaches to fix this:
Either add spaces 'ifconfig ' + interface + ' down'
Or the more correct solution is to separate your parameters into a list as that is what the subprocess
module expects:
subprocess.call(['ifconfig', interface, 'down'], shell=True)
subprocess.call(['ifconfig', interface, 'hw', 'ether', address], shell=True)
subprocess.call(['ifconfig', interface, 'up'], shell=True)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…