Results 1 to 6 of 6

Thread: [SOLVED] Could not change MAC. & Setup Macchanger auto spoofing/randomization in Kali

  1. #1
    Join Date
    2017-Apr
    Posts
    1

    Lightbulb [SOLVED] Could not change MAC. & Setup Macchanger auto spoofing/randomization in Kali

    Here's a simple solution to getting your mac address to either randomize or use a custom address upon rebooting or making a new wireless connections in Kali Linux. I decided to post this after having an issue with macchanger which I couldn't find a working solution for in the forum.

    After the latest system update, macchanger stoped working entirely. It would not change the MAC address for either wlan0 or eth0 and every attempt would return "[ERROR] Could not change MAC: interface up or insufficient permissions: Device or resource busy"

    # service NetworkManager stop
    # ifconfig wlan0 down
    # macchanger -r wlan0
    # ifconfig wlan0 up
    # service NetworkManager start
    This would return the error message and would not allow the address to change. I tried several other recommended methods with no success and finally decided to try to just reinstall macchanger which ultimately fixed the error.

    TO FIX THE ISSUE DO THE FOLLOWING:

    Remove macchanger
    # apt-get remove macchanger -y
    This command will also force the removal of fern-wifi-cracker & kali-linux-full...
    So install them all again.

    # apt-get install macchanger fern-wifi-cracker kali-linux-full -y
    After the install is complete the error message is no more. Now to set up automatic MAC spoofing/randomization. This is the same method that I use in Fedora & Redhat.

    First create a new startup service:

    # nano /etc/systemd/system/[email protected]
    Insert the following text into the new file:

    [Unit]
    Description=macchanger on %I
    Wants=network-pre.target
    Before=network-pre.target
    After=sys-subsystem-net-devices-%i.device

    [Service]
    ExecStart=/usr/bin/macchanger -r %I
    Type=oneshot

    [Install]
    WantedBy=multi-user.target
    Enable the new service and modify the interface name ('wlan0') to match your setup:

    # systemctl enable [email protected]e
    MACCHANGER WILL NOW RANDOMIZE YOUR MAC AT REBOOT
    IF YOU WISH TO HAVE MACCHANGER RANDOMIZE YOUR MAC WITH EACH NEW CONNECTION
    DO THE FOLLOWING:

    # nano /etc/NetworkManager/dispatcher.d/random_mac.sh
    Enter the following text into the file be sure to modify 'wlan0' to match your interface name:

    #!/bin/sh

    IF=$1
    STATUS=$2
    MACCHANGER=/usr/bin/macchanger
    WLANIFACE="wlan0"

    if [ -z "$IF" ]; then
    echo "$0: called with no interface" 1>&2
    exit 1;
    fi
    if [ ! -x $MACCHANGER ]; then
    echo "$0: can’t call $MACCHANGER" 1>&2
    exit 1;
    fi

    if [ "$IF" = "$WLANIFACE" ] && [ "$STATUS" = "down" ]; then
    /usr/sbin/ip link set $IF down
    $MACCHANGER -r $IF
    /usr/sbin/ip link set $IF up
    fi
    Now make the file executable:

    # chmod +x /etc/NetworkManager/dispatcher.d/random_mac.sh
    OPTIONAL: Every time you disconnect and reconnect to the same access point the DHCP server will give you a fresh IP address from the table. If you are constantly disconnecting and reconnection this can fill the table and in effect crash some routers. If you would like to prevent this, you can use an univocal DHCP identifier for the wireless card, instead of its MAC address.

    Create or edit the following file:

    # nano /etc/dhcp/dhcpclient.conf
    Edit or create the dhcp-client-identifier to any value you choose other than the default 'hardware':

    send dhcp-client-identifier = "kali_wifi_card";
    THATS IT. ENJOY YOUR NEW RANDOM MAC ADDRESS.
    Last edited by GoBlack; 2017-04-20 at 19:48.

  2. #2
    Join Date
    2017-Apr
    Posts
    1
    thanks
    me use
    ifconfig wlan0 down
    macchanger -m xx:xx:xx:xx:xx:xx wlan0
    ifconfig wlan0 up

    is that ok

  3. #3
    Join Date
    2016-Aug
    Posts
    9
    Or you could just open terminal and type
    crontab -e
    then at bottom of text add the line
    @reboot macchanger -r wlan0
    (assuming wlan0 is the interface device)
    Last edited by krunt0r; 2017-05-25 at 17:51. Reason: extra info

  4. #4
    Join Date
    2016-Oct
    Posts
    4
    My network is just saying connecting afterwards I followed your guide.

    What could I do to solve this.

  5. #5
    Join Date
    2013-Jul
    Posts
    844
    Remember that if Network Manager attempts to connect to a network it will override the mac address settings done by mac changer unless other things are done. There are numerous how-tos and approaches to this matter in this forum on how to prevent macchanger from affecting a spoofed mac address.

    Musket Teams

  6. #6
    Join Date
    2017-Sep
    Posts
    1
    Before I delete anything. This is what I am dealing with right now. Will the solution you explained help fix this problem?

    :: KALI SYSTEM (Desktop) ::
    :: CODE USED ::

    # ifconfig wlan0 down
    # macchanger -r wlan0

    I get a valid

    Current MAC: XX:XX:XX:XX:XX:XX
    Permanent MAC: XX:XX:XX:XX:XX:XX
    New MAC: XX:XX:XX:XX:XX:XX

    # ifconfig wlan0 up

    I connect back to my WLAN.

    :: WINDOWS SYSTEM (Laptop) ::

    I run Wireless Network Watcher
    The IP Address of my Desktop (Kali System) shows up = 192.168.x.x which is expected. Since I am on the same LAN.
    The problem is that my original Mac Address shows up alongside my IP.
    I don't know if it's because once I "# ifconfig wlan0 up" it reverts back to its origianal MAC?

    My desktop is not connected with ethernet either. It is only connected with wireless adapter.
    Does macchanger only work with monitor mode enabled?

    Any help or advice on this is appreciated.

Similar Threads

  1. Replies: 6
    Last Post: 2022-03-01, 13:20
  2. Unable to Change MAC Address using macchanger
    By CarlVerdejo in forum TroubleShooting Archive
    Replies: 5
    Last Post: 2016-11-28, 07:21
  3. Mac address spoofing does not work (macchanger)
    By xxyxxyxx in forum TroubleShooting Archive
    Replies: 7
    Last Post: 2013-05-07, 19:23

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
  •