Jump to content

How to use macchanger utility


lespacefish

Recommended Posts

So after testing it with the following payload(s):

ifconfig eth0 down
macchanger -m 7c:dd:90:f3:9f:5d eth0
ifconfig eth0 up

PUBLIC_TEST_URL="http://www.example.com"
C2CONNECT

LED SETUP
# Set NETMODE to DHCP_CLIENT for Shark Jack v1.1.0+
NETMODE DHCP_CLIENT

LED R SOLID
while ! ifconfig eth0 | grep "inet addr"; do sleep 1; done
LED Y SOLID
while ! wget $PUBLIC_TEST_URL -qO /dev/null; do sleep 1; done
LED G SOLID

I've been playing with the macchanger utility. When I have the 3 macchanger lines as the first 3 lines like above, the LED never makes it to SETUP (magenta) (I assumed it threw some error or crashed).

When I had the 3 lines in the following position, after the LED goes magenta it turns off and keeps restarting:

PUBLIC_TEST_URL="http://www.example.com"
C2CONNECT

LED SETUP
# Set NETMODE to DHCP_CLIENT for Shark Jack v1.1.0+
NETMODE DHCP_CLIENT

ifconfig eth0 down
macchanger -m 7c:dd:90:f3:9f:5d eth0
ifconfig eth0 up

LED R SOLID
while ! ifconfig eth0 | grep "inet addr"; do sleep 1; done
LED Y SOLID
while ! wget $PUBLIC_TEST_URL -qO /dev/null; do sleep 1; done
LED G SOLID

I am wondering if I am putting the macchanger lines in the wrong position, and why that might be. Maybe I am missing something silly. Any help would be super appreciated!

Link to comment
Share on other sites

I figured it out, you have to use thew following:

 

PUBLIC_TEST_URL="http://www.example.com"
C2CONNECT

LED SETUP
# Set NETMODE to DHCP_CLIENT for Shark Jack v1.1.0+
NETMODE DHCP_CLIENT

LED B SOLID
ifconfig eth0 down
ifconfig eth0 hw ether 7c:dd:90:f3:9f:5d
ifconfig eth0 up
LED C SOLID

LED R SOLID
while ! ifconfig eth0 | grep "inet addr"; do sleep 1; done
LED Y SOLID
while ! wget $PUBLIC_TEST_URL -qO /dev/null; do sleep 1; done
LED G SOLID

macchange didn't seem to work properly, but using ifconfig to change the mac address (AFTER SETTING NETMODE, it seems to be where the mac is randomized) works like a charm!

Link to comment
Share on other sites

  • 3 months later...
Just now, flipchart said:

@lespacefish thank you for sharing!

 

Any idea what I can do if I do not want a dhcp but only a static IP *and* the custom MAC?

You should be able to use normal linux ifconfig and other networking tools to set your static IP! Nothing specific to the sharkjack.

Link to comment
Share on other sites

I am getting pretty tired now... I really tried hard, i must be missing something:

As I do not want to fire off a DHCP request, i selected NETMODE TRANSPARENT. With the following ifconfig commands I tried to achieve static IP and hw address set:

# Change MAC address
ifconfig eth0 down
ifconfig eth0 hw ether 00:XX:XX:XX:XX:XX
ifconfig eth0 192.168.2.102 netmask 255.255.255.0 up

route add default gw 192.168.2.1

and I always get a random MAC.

When I select NETMODE DHCP i get my custom MAC but an IP from DHCP...

 

I was already looking for a way to set the shark random MAC to my custom MAC, but there must be an easier way... what am I missing?

Link to comment
Share on other sites

On 5/6/2020 at 7:57 PM, kdodge said:

This is the configuration file/system for most linux OSes

Well, the shark jack is an openwrt, so the networking should be defined in /etc/config/network. And then there is the NETMODE command... But luckily the NETMODE command is just the following script:

root@shark:/etc/config# cat /usr/bin/NETMODE 
#!/bin/bash

function show_usage() {
    echo "Usage: $0 [DHCP_CLIENT|DHCP_SERVER]"
    echo ""
}

case $1 in
    "DHCP_CLIENT")
        uci set network.lan.proto='dhcp'
        ;;
    "DHCP_SERVER")
        uci set network.lan.proto='none'
        /etc/init.d/odhcpd start
        ;;
    *)
        show_usage
        exit 0
        ;;
esac

so i tried to setup everything with uci in the payload:

    uci set network.lan.proto='static'
    uci set network.lan.macaddr='13:37:13:37:13:37'
    uci set network.lan.ipaddr='10.11.12.188'
    uci set network.lan.gateway='10.11.12.1'
    uci set network.lan.dns='8.8.8.8'
    uci set network.lan.netmask='255.255.255.0'

    /etc/init.d/network restart

This works, except for the MAC address...

 

I kind of think that the network restart also assigns a random MAC, but I am not yet down there...

Link to comment
Share on other sites

Ok, I got the SOLUTION! :

STATIC IP AND CUSTOM MAC:

    # Set Static IP & Custom MAC
    uci set network.lan.proto='static'
    uci set network.lan.ipaddr='10.11.12.188'
    uci set network.lan.gateway='10.11.12.1'
    uci set network.lan.dns='8.8.8.8'
    uci set network.lan.netmask='255.255.255.0'

    /etc/init.d/network restart

    ifconfig eth0 down
    ifconfig eth0 hw ether 12:00:15:b7:13:37
    ifconfig eth0 up

This way you set your static IP, restart network to commit the changes, take eth0 down, set MAC and put eth0 back up again. If you restart the network, you get another random MAC.

 

Thank you for all the support 🙂 especially @kdodge && @lespacefish

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...