Results 1 to 8 of 8

Thread: Fast MAC Address Changer in Linux

  1. #1
    Just burned his ISO
    Join Date
    Apr 2010
    Location
    Mexico City
    Posts
    2

    Default Fast MAC Address Changer in Linux

    Hi everyone. I am new in you community and I hope I can learn a lot here and share my knowledge with you.

    I've created a tool for changing the MAC address of a linux box. I work as Pentester in Mexico City and sometimes during the pentest some sysadmin triest to block us creating ACLs for the IPs or Mac Address of our boxes, so I created this script that randomly generates a new Mac and assign it to the device you input.

    I hope you find it useful.

    Here is the code.

    Code:
    #!/bin/bash
    # Script by Adrian Puente Z. apuente _AT_ hackarandas _dot_ com
    # Powered by Hackarandas www.hackarandas.com
    # Licensed by GNU GPLv3
    # http://www.gnu.org/licenses/gpl-3.0.txt
    
    [ $# -eq 0 ] && echo  "Sintax: `basename $0` <interface>" && exit 0
    
    [ `id -u` -ne 0 ] && echo "Only root can do that! sudoing…"
    if [ "$EUID" != 0 ]; then sudo `which $0` $1; exit; fi
    
    INT=$1
    
    function gennewmac
    {
    hexdump  /dev/urandom | head -3 |\
         cut -d‘ ‘ -f2 | while read -n 2 i
                 do echo -n $i:
                 done | sed ’s/::/:/g;s/:$//g’
    }
    
    if  ifconfig ${INT} 2> /dev/null 2>&1 | head -1
    then
        NEWMAC=`gennewmac`
        sleep 3
        if  ifconfig ${INT} down hw ether ${NEWMAC} 2>/dev/null
        then
            echo Interface ${INT} has new mac:
            ifconfig ${INT} 2> /dev/null 2>&1 | head -1
            ifconfig ${INT} up
            echo Restart dhcp client to get a new IP.
        else
            echo "Error changing MAC to ${NEWMAC}!"
            echo "Try again with the same command."
            exit 1
        fi
    else
        echo "Interface ${INT} doesn’t exists!"
        exit 1
    fi
    exit 0
    You can visit the source post in my blog:

    Hackarandas

    If you have any doubt or comment plz tel me.

    Greets,
    ..:: ch0ks ::..

  2. #2
    Just burned his ISO
    Join Date
    Mar 2010
    Posts
    19

    Default Re: Fast MAC Address Changer in Linux

    I have seen several of these around and I frankly don't understand WHY. What is their purpose other than perhaps to teach coding. I understand the need to spoof a MAC address. But why does it have to be random. That makes no sense to me.

  3. #3
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default Re: Fast MAC Address Changer in Linux

    That's one of the ways in which skiddies and their ilk can try to do bad things to (and with) other peoples networks and kittens.

  4. #4
    Junior Member
    Join Date
    Nov 2007
    Posts
    36

    Default Re: Fast MAC Address Changer in Linux

    I'm not trying to be sarcastic---but why not just use:

    macchanger ethx -r
    Last edited by prelate; 04-10-2010 at 01:31 AM.

  5. #5
    Just burned his ISO
    Join Date
    Apr 2010
    Posts
    7

    Default Re: Fast MAC Address Changer in Linux

    I agree...macchanger far faster....

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Location
    on this page
    Posts
    34

    Default Re: Fast MAC Address Changer in Linux

    Quote Originally Posted by prelate View Post
    I'm not trying to be sarcastic---but why not just use:

    macchanger ethx -r
    Could not agree more this is what I would use.

  7. #7
    Just burned his ISO incredible's Avatar
    Join Date
    May 2010
    Location
    Somewhere on earth
    Posts
    15

    Default Re: Fast MAC Address Changer in Linux

    Quote Originally Posted by chap0 View Post
    Could not agree more this is what I would use.
    im using simple macchanger and it helps me anytime...

    but...

    he is just contributing his knowledge which is good

    nice mate,

    cheers

  8. #8
    Member macphail's Avatar
    Join Date
    Jun 2010
    Location
    East Coast, USA
    Posts
    164

    Default Re: Fast MAC Address Changer in Linux

    Quote Originally Posted by Archangel-Amael View Post
    That's one of the ways in which skiddies and their ilk can try to do bad things to (and with) other peoples networks and kittens.


    I'll continue to use macchanger simply for the kitten's sake...but good job anyway!
    -----------
    ~peace
    MacPhail

Similar Threads

  1. Obtendo o nome do host e o MAC address rapidamente
    By firebits in forum Tutoriais e Howtos
    Replies: 0
    Last Post: 03-28-2010, 07:02 PM
  2. How to set up an IP address in FAST-TRACK
    By xioncn in forum Beginners Forum
    Replies: 0
    Last Post: 02-13-2010, 01:45 PM
  3. DECnet node address
    By JohnT in forum Beginners Forum
    Replies: 1
    Last Post: 02-11-2010, 08:09 PM
  4. Finding IP address without DHCP
    By Warwulf in forum Beginners Forum
    Replies: 3
    Last Post: 02-10-2010, 05:54 AM
  5. NMAP scan of my real IP address
    By Linus1907 in forum Beginners Forum
    Replies: 13
    Last Post: 02-01-2010, 10:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •