问题描述
这是我的代码:
import subprocess
import optparse
parser = optparse.OptionParser()
parser.add_option("-i","--interface",dest="interface",help="interface to change MAC adress")
parser.add_option("-m","--mac",dest="mac",help="new mac adress")
(options,arguments) = parser.parse_args()
interface = options.interface
mac = options.mac
#print("(+) Your mac adress for " + interface + " has been changed to " + mac)
subprocess.call(["sudo ifconfig",interface,"down"])
subprocess.call(["sudo ifconfig","hw","ether",mac])
subprocess.call(["sudo ifconfig","up"])
这是错误:
Traceback (most recent call last):
File "mac_changer.py",line 10,in <module>
subprocess.call(["sudo ifconfig","down"])
File "/usr/lib/python3.8/subprocess.py",line 340,in call
with Popen(*popenargs,**kwargs) as p:
File "/usr/lib/python3.8/subprocess.py",line 858,in __init__
self._execute_child(args,executable,preexec_fn,close_fds,File "/usr/lib/python3.8/subprocess.py",line 1639,in _execute_child
self.pid = _posixsubprocess.fork_exec(
TypeError: expected str,bytes or os.pathLike object,not nonetype
我使用的是 Ubuntu 20.04。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)