C помощью python пишу скрипт для замены мак адресса, питон выдает ошибку
import subprocess
import optparse
def get_arguments():
parser = optparse.OptionParser()
parser.add_options("-i", "--interface", dest="interface", help="Interface to change its MAC address")
parser.add_options("-m", "--mac", dest="new_mac", help="New MAC address")
(options, arguments) = parser.parse_args()
if not options.interface:
parser.error("[-] Please specify an interface, use --help for more info.")
elif not options.new_mac:
parser.error("[-] Please specify a new mac, use --help for more info.")
return options
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", "ether", new_mac])
subprocess.call(["ifconfig", interface, "up"])
options get_arguments()
change_mac(options.interface, options.new_mac)
--------
Вот что пишет питон
options get_arguments()
^
SyntaxError: invalid syntax
import subprocess
import optparse
def get_arguments():
parser = optparse.OptionParser()
parser.add_options("-i", "--interface", dest="interface", help="Interface to change its MAC address")
parser.add_options("-m", "--mac", dest="new_mac", help="New MAC address")
(options, arguments) = parser.parse_args()
if not options.interface:
parser.error("[-] Please specify an interface, use --help for more info.")
elif not options.new_mac:
parser.error("[-] Please specify a new mac, use --help for more info.")
return options
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", "ether", new_mac])
subprocess.call(["ifconfig", interface, "up"])
options get_arguments()
change_mac(options.interface, options.new_mac)
--------
Вот что пишет питон
options get_arguments()
^
SyntaxError: invalid syntax