-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmac_changer.py
51 lines (31 loc) · 1.47 KB
/
mac_changer.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#/usr/bin/env python
import subprocess
import optparse
import default_change
import random_change
subprocess.call(["chmod", "+x", "changer.sh"])
subprocess.call(["chmod", "+x", "default_changer.sh"])
subprocess.call(["chmod", "+x", "random_changer.sh"])
parser=optparse.OptionParser()
parser.add_option("-i", "--interface", dest="interface", default="", help="set interface to change the MAC address")
parser.add_option("-d", "--default", action="store_true", dest="default", default=False, help="return the interface to the original MAC Address")
parser.add_option("-m", "--mac", dest="newMac", default="", help="set the new MAC Address (if not set, a random one will be set)")
(options, arguments) = parser.parse_args()
interface=str(options.interface).strip()
newMac=str(options.newMac).strip()
default=options.default
print("---- MAC Changer ----\n\n")
if not interface:
parser.error("[-] Specify an interface! Use --help for more info.")
else:
if default:
default_change.defaultChange(interface)
elif not newMac:
random_change.randomChange(interface)
else:
output = subprocess.run(["./changer.sh", interface, newMac], capture_output=True).stdout
if "New MAC" not in str(output):
print("[-] Invalid interface or MAC Address!")
else:
print(output)
print(f"\n[+] {interface} MAC Address changed!")