-
Notifications
You must be signed in to change notification settings - Fork 0
/
machanger.py
28 lines (23 loc) · 1.08 KB
/
machanger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import subprocess
import platform
import re
class MaChanger:
def result(res):
return res
def linuxMac(interface, new_mac):
subprocess.call(["ifconfig", interface, "down"])
subprocess.call(["ifconfig", interface, "hw", "ether", new_mac])
subprocess.call(["ifconfig", interface, "up"])
def macMac(interface, new_mac):
subprocess.call(["ifconfig", interface, "down"])
subprocess.call(["ifconfig", interface, "ether", new_mac])
subprocess.call(["ifconfig", interface, "up"])
def winMac(interface, new_mac):
try:
subprocess.call(["netsh", "interface", "set", "interface", "name=", interface, "admin=disable"])
subprocess.call(["netsh", "interface", "set", "interface", "name=", interface, "admin=enable"])
current_mac = subprocess.check_output(["getmac", "/v", "/fo", "list"])
if new_mac in str(current_mac):
print(f"MAC address successfully changed to {new_mac}")
except Exception as kek:
print(kek,"kafjasdfa")