Python Forum

Full Version: eth0: [ERROR] Set device name: No such device
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I cannot change the MAC address in my Kali VM with this Python code:
interface = input("interface > ")
new_mac = input("new MAC > ")
subprocess.call(["ifconfig", interface, "down"])
subprocess.call(["sudo", "-S", "macchanger", "--mac=", new_mac, "", interface])
subprocess.call(["ifconfig", interface, "up"])
but I could change it with this code:
interface = input("interface > ")
new_mac = input("new MAC > ")
subprocess.call("ifconfig " + interface + " down" , shell=True)
subprocess.call("sudo -S macchanger --mac=" + new_mac + " " + interface, shell=True)
subprocess.call("ifconfig " + interface + " up", shell=True)
Here are the input commands and the error:
Error:
interface > eth0 new MAC > 00:11:11:11:11:11 [+] Changing MAC address for eth0 to 00:11:11:11:11:11 SIOCSIFFLAGS: Operation not permitted [ERROR] Set device name: No such device SIOCSIFFLAGS: Operation not permitted
I also always get the
Error:
SIOCSIFFLAGS: Operation not permitted
error, I would like to fix that too.