Jump to content

How to use macchanger utility


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 post
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 post
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 post
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 post
Share on other sites

I'm wondering if the sharkjack uses "interfaces", does it have the file /etc/network/interfaces?

maybe there's a man file for it,

$ man interfaces

This is the configuration file/system for most linux OSes

Link to post
Share on other sites

Okay, FYI I don not have a sharkjack to test this on, but I looked at the sharkjack's firmware and its based on OpenWRT.  The OpenWRT way to adjust the network settings can be found here:

https://openwrt.org/docs/guide-user/base-system/basic-networking

the file "squashfs-root/usr/lib/config/switch3" contains the networking config where you might be able to make changes to it. The problem is, that it looks like this might be compiled into a squashfs archive, in which case it will not be a simple task to edit. If you can edit it, you might want to change it to something like this:

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'lan'
	option ifname 'eth0'
	option proto 'none'
	option macaddr '62:11:22:aa:bb:cc'

 

WARNING: I can't guarantee this will work at all and I don't want to be responsible for bricking a device, so proceed at your own risk.

 

a.png

Link to post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...