-
Notifications
You must be signed in to change notification settings - Fork 3
/
macchanger.sh
executable file
·43 lines (40 loc) · 1.25 KB
/
macchanger.sh
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
#Author: Pablo Moles
#Read the README file for more information
#!/bin/sh
if [ $# > 1 ] || [ $# == 1 ] ;
then
if [ "$1" == "-r" ] || [ "$1" == "--random" ];
then
mac=$(echo "obase=16; $((RANDOM%239+16))" | bc)':'$(echo "obase=16; $((RANDOM%239+16))" | bc)':'$(echo "obase=16; $((RANDOM%239+16))" | bc)':'$(echo "obase=16; $((RANDOM%239+16))" | bc)':'$(echo "obase=16; $((RANDOM%239+16))" | bc)':'$(echo "obase=16; $((RANDOM%239+16))" | bc) ;
echo $mac
sudo ifconfig $2 ether $mac
exit
elif [ "$1" == "--help" ] || [ "$1" == "-h" ];
then
echo
echo "Usage: macchanger [OPTIONS] interface"
echo
echo "-h, --help Print this help"
echo "-r, --random Set fully random MAC"
echo "-0, --original Set the original MAC"
echo "-m, --mac XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX"
echo
exit 1
elif [ "$1" == "-0" ] || [ "$1" == "--original" ];
then
#Change the value for your original MAC
mac="ORIGINAL_MAC"
elif [ "$1" == "-m" ] || [ "$1" == "--mac" ];
then
mac=$2
sudo ifconfig $3 ether $mac
exit
else
#Edit with the correct path of the script
%PATH_TO_SCRIPT%/macchanger.sh -h
exit
fi
sudo ifconfig $2 ether $mac
else
echo "Usage: macchanger [OPTIONS] interface"
fi