Skip to content

Instantly share code, notes, and snippets.

@r00tw33d
Created April 13, 2010 01:13
Show Gist options
  • Save r00tw33d/364210 to your computer and use it in GitHub Desktop.
Save r00tw33d/364210 to your computer and use it in GitHub Desktop.
#!/bin/bash
##################################################################
#
# Script elaborado para cambiar la MAC address ^^
#
# Dependencias: macchanger
#
# Author twitter: @r00t_w33d
#################################################################
#comprobando privilegios
if [ "$(id -u)" == "0" ]; then
#opcion 2: if [ "$(whoami)" != "root" ]; then
#comprobando interfaz de red
if [ -z $1 ]; then
echo $'Error: Lost interface\n\nusage:\n\t# ' $0 $' <interfaz> [MAC_ADDR]\n'
exit
fi
#tiramos interfaz
ifconfig $1 down
if [ -z $2 ]; then
#cambiamos dos veces de MAC, para más placeeer
TEST=`macchanger -A $1`
TEST=`macchanger -A $1 | grep Faked`
else
#si se pasó como parámetro una MAC definida, la tomamos en cuenta
TEST=`macchanger -m $2 $1 | grep Faked`
fi
#levantamos interfaz
ifconfig $1 up
#mensaje de cambios
echo $TEST
else
echo "Aborting. Are u r00t?"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment