Please help me debug the error below.
Thanks.
traceback (most recent call last):
File “changemac.py”, line 23, in
change_mac(options.interface, options.new_mac)
AttributeError: Values instance has no attribute ‘new_mac’
Below is my code
#!/usr/bin/env python
import subprocess
import optparse
def change_mac(interface, new_mac):
print("[+] changing mac address for" + interface + “to” + new_mac)
subprocess.call(["ifconfig", interface, "down"])
subprocess.call(["ifconfig", interface, "hw", "either", new_mac])
subprocess.call(["ifconfig", interface, "up"])
parser = optparse.OptionParser()
parser.add_option("-i", “–interface”, dest = “interface”, help=“interface to change its mac address”)
parser.add_option("-m", “–mac”, help=“new mac address”)
(options, arguments) = parser.parse_args()
change_mac(options.interface, options.new_mac)