Forum Thread: Need Help Writing a Script.

Need Help Writing a Script.

Like many others I've been lurking in the shadows of this site for about a year now, I've contributed when and where i could but now i must ask for a bit of help. I'm currently taking classes on Java, and python but i can't seem to get this script right. I've deleted everything and am now starting from scratch.

My issue is this, I have a external alfa wifi adapter that sometimes looses connection with my laptop. It's most likely that the usb ports on my laptop are worn out. The problem is that when it looses power and then regains it and reconnects to wifi the mac address returns to normal. I've written a small script to change the mac but it is inconvenient to stop what i am doing disconnect from the wifi and run the script. I've read into hot-plugging and such but have yet to figure out how to write a script, that will automatically run when each time the device is plugged in. The script would be fairly simple i assume, just an extension of the following.....

ifconfig wlan1 down
macchanger -a wlan1
ifconfig wlan1 up

Any help or guidance would be forever appreciated.

3 Responses

Can i just modify the mac address in the persistent rules folder and have it permanently spoof the mac address?

Was able to use your suggestion and use udev to write a rule to run my script every time the device connects. Much thanks to you sir!

Share Your Thoughts

  • Hot
  • Active