Translate in Your language

Friday, 13 March 2020

Changing MAC address using python code - prompting input

Changing MAC address is common process when comes to security domain for operations like pen-testing. However, can also be used on virtual environment for linux based workloads. Copy below code and save it as .py file. Then run the python script to test.

# Mac changer code

Import subprocess

iface = input("Name of Interface for changing MAC Address: ")
nmac = input("Type the new MAC Address to be used: ")

def mchange():
    print("Changing the MAC Address as per the input")["ifconfig", iface, "down"])["ifconfig", iface, "hw", "ether", nmac])["ifconfig", iface, "up"])
    print("MAC Address changed Successfully to: " + nmac)


Other versions of this code:

GUI based
Input Parsing

No comments:

Post a Comment


Popular Posts This Week