[Nexus S General] hu_ciao:
Scripts spoof MAC address

0. The forum helped me. Maybe this helps someone else?

Here are a couple of scripts for MAC address spoofing.

The scripts are good if you run other scripts on your system. Also recommended to users who wish to use valid OUIs when randomizing MAC address.

Randomizes and changes MAC using common "busybox ifconfig" method.

Using random spoofed MAC hides NIC make from attackers. Protects privacy -- avoids some tracking without disabling wifi.

Requires rooted phone/tablet, busybox, terminal emulator or Gscript etc.

Tested on SGS3 with cyanogenmod.

1a. ranMAC.sh generates and sets random MACs which have minimal unicast format.

Some cases of failed MAC address changes will be the result of rejection of addresses not in unicast format.

Resets to original MAC address from info in system file /system/etc/wifi/nvram_net.txt. This file may not be in your system or have wrong data.

Edit variable "nvram" in script to point to correct file.

1b. ranMAC_v01.sh uses valid OUI (Organizationally Unique Identifier). This avoids OUI-based spoofing detection and rejection used by some hotspots.

First run will generate the file MAC.bak to store original MAC address.

Edit file to also spoof preset MAC addresses. Nb. file will have root ownership. Add MAC addresses, one per line, to MAC.bak for preset address spoofing.

2. NIC name, extract and install

Scripts use wlan0 to refer to wifi NIC. Check your requirements.

For use with eth0 replace all instances of wlan0 with eth0.

# From ranmac directory do:

sed -i 's/wlan0/eth0/g' ranMAC_v01.sh ranMAC.sh reup.sh

Extract ranmac.tar.bz2 (directory and contents) from Download.

At the command line (terminal) in /sdcard/Download directory:

tar -xvjf test.tar.bz2 -C ../

You should get this directory: /sdcard/ranmac and may then delete the tar.bz2.

To run from elsewhere edit "rpath" in script or uncomment the line with "get path" option.

Run from CLI, "the terminal", though using Gscript is more convenient.

My tester reported Gscript didn't exit cleanly, but did not interfere with the scripts.

Perhaps try a new version of Gscript app?

--------------

[APP] Gscript * Easily launch/save shell scripts from within Android UI

https://xdaforums.com/showthread.php?t=486486

---------------

MakeItWayne had a good idea: use an event-based trigger.

Maybe run script when the wifi is enabled/starts etc.

---------------

https://xdaforums.com/nexus-s/general/update-18-05-13-spoof-wifi-mac-address-t1385577/page20

---------------

3. Examples and options:

# with su

sh [path]/ranMAC_v01.sh

sh [path]/ranMAC_v01.sh -r

sh [path]/ranMAC_v01.sh -r 2

sh [path]/reup.sh

# Not for Gscript

sh [path]/menu.sh

# Default [path] is /sdcard/ranmac

Restore original MAC with -r argument. Use -r <line_number> for presets.

Option fo CLI (terminal) is menu.sh (works with ask.sh). Not for Gscript. Use as-is or edit menu items. Maybe uncomment reup option,

[ insert image screencap menu.png ]

If wifi connection not made readily try reup.sh. Does not change your spoofed MAC address. Will not interfere with wifi if already connected.

Cycle power or wifi (off/on) reverts to hard-coded MAC address. This script does "soft" MAC change.

Files included:

ask.sh oui-get.txt ranMAC.sh reup.sh

menu.sh oui_nr.txt ranMAC_v01.sh

--Sorry for post length. Lack time to shorten it.

[ Free to use at your own risk -- no warranty offered or implied. Author retains all rights. ]