Hacker News new | ask | show | jobs
by jayalpha 2419 days ago
macchanger

Also extends time limites wifi.

Or use my gypsy code

import random

import os

mac=''

os.system('/etc/init.d/networking stop')

os.system('ifconfig wlan1 down')

os.system('ifconfig eth1 down')

os.system('ifconfig wlp8s0 down')

os.system('ifconfig wlp7s0 down')

for i in range(0,3):

__r=random.randint(16, 256)

__mac=mac+":"+str(hex(r))[2:]

mac="00:07:E9"+mac

print mac

os.system('/etc/init.d/networking stop')

os.system('ifconfig wlan1 hw ether '+mac)

os.system('ifconfig wlp8s0 hw ether '+mac)

os.system('ifconfig wlp7s0 hw ether '+mac)

os.system('ifconfig eth1 hw ether '+mac)

os.system('ifconfig wlan1 up')

os.system('ifconfig eth1 up')

os.system('ifconfig wlp8s0 up')

os.system('ifconfig wlp7s0 up')

os.system('/etc/init.d/networking start')

os.system('ifconfig')

print "echo 'MAC changed..."

print "new random MAC "+mac

2 comments

You need to indent the code by at least 2 spaces so it doesn't collapse into a paragraph like that. Also, that script isn't really portable. Not everyone has those interface names nor /etc/init.d/networking.
It is gypsy code and works for me. Use macchanger instead of adopt the script for your purposes.
What is "gypsy code"? I first thought you were referring to a library or some kind of platform, but that doesn't seem to be it. The only definition I find of gypsy is that of the people. Maybe you're saying that it was written by a Gypsy, but I don't know why that'd be of interest.
It meant a quick and dirty fix.
ifconfig is a part of net-tools package, last release of which was in 2001 hence it's deprecated in any major distro since 2013. Unless you're running RHEL6 or something that old, you shouldn't use it.