onsdag 25. februar 2015

a bash shell script that changes your networkcards macadress to random

This could be accomplished on a linux by this code, in this case a script called: macfake.sh

user=`whoami`                                                                            
#comment
if [ $user != "root" ]; then                                                            
        echo user
        echo ": user not root - changing user and exec again"
        exec sudo -u root macfake.sh                            
fi            
if [ $user == "root" ]; then                                                            
        echo "user root - all ok!"                              
fi            

echo "changing mac adress on eth0"
ifconfig eth0 down
echo "-eth0 down, ok!"
macchanger --random eth0
echo "--eth0 randomized, ok!"
ifconfig eth0 up
echo "-eth0 up, ok!"

echo "changing mac adress on wlan0"
ifconfig wlan0 down
echo "-wlan0 down, ok!"
macchanger --random wlan0
echo "--wlan0 randomized, ok!"
ifconfig wlan0 up
echo "-wlan0 up, ok!"

echo "finished ok!"