MAC Spoofing

Target :
Change the Logical MAC Address Every 3 Minutes on Windows
MAC Spoofing With Python
import ctypes, sys, subprocess, random, time
INTERFACE = "Wi-Fi"
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
def generate_mac():
mac = [0x02, random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff)]
return "".join(f"{b:02X}" for b in mac)
def change_mac(interface, mac):
print(f"[+] Changing {interface} MAC to {mac}")
try:
subprocess.run([
"powershell", "-Command",
f'Set-NetAdapterAdvancedProperty -Name "{interface}" -DisplayName "Network Address" -DisplayValue "{mac}"'
], check=True)
subprocess.run([
"powershell", "-Command",
f'Restart-NetAdapter -Name "{interface}" -Confirm:$false'
], check=True)
except subprocess.CalledProcessError as e:
print("[-] Failed to change MAC:", e)
def main():
while True:
new_mac = generate_mac()
change_mac(INTERFACE, new_mac)
print("[*] Waiting 3 minutes before next change...\n")
time.sleep(180)
if __name__ == "__main__":
if not is_admin():
print("[!] Restarting script as Administrator...")
ctypes.windll.shell32.ShellExecuteW(
None, "runas", sys.executable, " ".join(sys.argv), None, 1
)
else:
main()
Choose Interface
make function to check Admin or not
Generate MAC
Change MAC by running PowerShell command
MAC Spoofing With Registry
# Run this script as Administrator
# Adapter name you want to change (Wi-Fi)
$AdapterName = "Wi-Fi"
# New MAC address (12 hex characters, no separators)
$NewMAC = "02AB4C90D3F1"
# Registry base path for all network adapters
$BasePath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}"
# Find the registry key for the adapter
$Adapter = Get-NetAdapter -Name $AdapterName
if (-not $Adapter) {
Write-Host "[-] Adapter $AdapterName not found."
exit
}
$RegKey = Get-ChildItem $BasePath | Where-Object {
(Get-ItemProperty $_.PSPath).NetCfgInstanceId -eq $Adapter.InterfaceGuid
}
if (-not $RegKey) {
Write-Host "[-] Could not locate registry key for $AdapterName"
exit
}
# Set or update the NetworkAddress value
Set-ItemProperty -Path $RegKey.PSPath -Name "NetworkAddress" -Value $NewMAC
Write-Host "[+] MAC Address for $AdapterName set to $NewMAC in registry."
# Restart adapter to apply changes
Write-Host "[*] Restarting adapter..."
Disable-NetAdapter -Name $AdapterName -Confirm:$false
Start-Sleep -Seconds 2
Enable-NetAdapter -Name $AdapterName -Confirm:$false
Write-Host "[+] Done! New MAC should be active."
.\Change-MAC.ps1




