Script for spoofing MAC address at boot in Puppy (Lucid-525)

Requests go here. If you fill a request, give it a new thread in the appropriate category and then link to it in the request thread.
Post Reply
Message
Author
B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

Script for spoofing MAC address at boot in Puppy (Lucid-525)

#1 Post by B.K. Johnson »

Change MAC address at boot in Puppy (Lucid-525)

I connect to the Internet at my local library, sometimes using one of their computers on the network and at other times from my laptop using the free wireless connection they provide. The ISP is the one that provides the FREE service, so they despise my heavy traffic usage (all those isos). When I am using one of the library's computers, the ISP deliberately interrupt downloads and generally antagonize me. They recognize me by snooping when I log in to yahoo mail and from what I do.

With the WiFi, as soon as I boot up Lucid-525 from my flash drive, they disable the connection (I can see the LED change from blue to amber). Powering off or rebooting has the same result. I am denied access no matter which of 3 puppies on the flash drive I boot from but Wary seems less vulnerable. Obviously, they know my MAC address.
Apologies for the long preamble.

Spoofing my MAC address seems to be the solution. I have googled and read many threads on the topic and they all agree on the command line solution for an eth0 connection: type in at the console
ifconfig eth0 down
ifconfig eth0 hw ether <fake MAC address>
ifconfig eth0 up

and similarly for the wireless
ifconfig wlan0 down
ifconfig wlan0 hw ether <fake MAC address>
ifconfig wlan0 up

Entering the commands from the command line isn't my problem. I need to boot up and spoof the address before the ISP sees the real one. So, I need a bash script that

1, determines the interface of the connection (is it eth0 or wlan0?).
2. executes the appropriate code segment for the connected interface.
3. has the "start" and "stop" command line parameters noted in /etc/init.d/README.
4. has the execute flag set (I can do that). :wink:

What would be nice is to be able to randomly pick a MAC address from a list in a file and insert in the command.

My understanding is that if the script is placed in /etc/init.d and the execute flag set, it will start during the boot process.

I have found code snippets for other distros at How to Change or Spoof MAC Address.htm, but there doesn't appear to be comparable Puppy commands for those used. Here are 2 FWIW.

This snippet from a poster on OpenBSD seemed particularly elegant:
if [ "$if" ="INTERFACE" ] then;
ifconfig <interface> lladr <MAC address in format of 02:01:02:03:04:08>
fi

Puppy doesn't seem to have/use 'lladr'! Perhaps hw is the equivalent.


Another poster suggested this could work for any Linux
ifconfig <interface> down

ifconfig <interface> hw <class> <MAC address>

ifconfig <interface> up
The thread also notes that sometimes the ifconfig commands don't work. For Fedora systems, /etc/init.d/networking stop and /etc/init.d/networking start have to be used. Barry's "start" and "stop" may be analogues for these commands, but what should they be in this case (see 3 above)?

My Q&D inelegant pseudo-code:
Assuming a global variable $INTERFACE that holds the active interface in Puppy (would be nice to have if one does not already exist).
iface= $INTERFACE #returns eth0 or wlan0
ifconfig iface down
ifconfig iface hw ether <fake MAC address>
ifconfig iface up


Thanks.
B. K. Johnson

Post Reply