import sys
import subprocess
import tkinter as tk
from tkinter import tsk
gui = tk.Tk()
gui.title('MAC-Changer')
interface_name = ttk.Label(gui, text="Enter the interface name: ")
interface_name.grid(row=0, column=0, sticky=tk.W)
intface_name = tk.StringVar()
interface_name_entry = ttk.Entry(gui, width = 20, textvariable=intface_name)
interface_name_entry.grid(row=0, column=1)
mac = ttk.Label(gui, text="Enter new MAC address: ")
mac.grid(row=1, column=0, sticky=tk.W)
mac = tk.StringVar()
mac_addr = ttk.Entry(gui, width=20, textvariable=mac)
mac_addr.grid(row=1, column=1)
def changemac():
iface = intface_name.get()
nmac = mac.get()
if not iface:
sys.exit("Invalid input.")
elif not nmac:
sys.exit("Invalid input.")
else:
print("Changing the MAC Address as per the input")
subprocess.call(["ifconfig", iface, "down"])
subprocess.call(["ifconfig", iface, "hw", "ether", nmac])
subprocess.call(["ifconfig", iface, "up"])
sys.exit("MAC Address successfully changed to: ")
mac_button = ttk.Button(gui, text="Change MAC", command=changemac)
mac_button.grid(row=4, column=1)
gui.mainloop()
Changing MAC using python code – GUI interface
Latest posts
-
The Modern Private Cloud—What is VMware Cloud Foundation 9?
For over two decades, VMware transformed the data center by abstracting hardware into software. But as we entered the era of multi-cloud and AI, the challenge shifted from “how do I…
·
-
VCF 9 vs VVF: Which VMware Solution is Right for You?
Since the Broadcom acquisition, the VMware portfolio has undergone its most significant transformation in decades. For the “Virtual Maestro” community, the shift from hundreds of individual point products to two…
-
What is Virtualization-Based Security for Windows Guest Operating Systems
Virtualization-Based Security (VBS) for Windows guest operating systems is a security feature that uses hardware virtualization to create and isolate a secure region of memory from the normal operating system.…
·

Leave a comment