feross / SpoofMAC

:briefcase: Change your MAC address for debugging
https://feross.org/spoofmac/
3.02k stars 271 forks source link

OSX Yosemite breaks Spoof-Mac #36

Closed Parsav closed 9 years ago

Parsav commented 9 years ago

You can run the program, it sucessfuly turns off and on the wifi, but doesn't change the address

feross commented 9 years ago

What version are you running? You can find out by running it with the --version flag.

Parsav commented 9 years ago

Spoof-Mac 1.2.1

feross commented 9 years ago

2.0.0 is the latest verison. Can you update and try again?

Parsav commented 9 years ago

when i list the networks, it says that it is changed, but my settings say otherwise as well as the fact that i can connect to a network that has whitelisted MAC addresses

Parsav commented 9 years ago

yeah. that was the version that the easy_install pulled

feross commented 9 years ago

The command name changed in 2.0.0 (see https://github.com/feross/SpoofMAC/issues/34). It's now spoof-mac.py. Make sure you're running the right program, in case they old one is still installed.

Parsav commented 9 years ago

ah. i wasnt, but that hasn't changed anything.

Parsav commented 9 years ago

have you tested on yosemite? is this just on my end?

feross commented 9 years ago

It works perfectly for me. I'm also on Yosemite.

feross commented 9 years ago

But to install I did:

sudo easy_install pip
sudo pip install SpoofMAC
feross commented 9 years ago

I would trust the output of spoof-mac.py list. It comes directly from ifconfig.

Parsav commented 9 years ago

i got it. it was that i wasnt using the .py command. The fact that it didnt work last night was because my whitelister was off for some reason. Sorry about all this. im new to Git and had trouble with the layout. Thank you for making this though, this is an awesome tool and one of the only ones out there.

feross commented 9 years ago

No problem. Have a good one :)

arkanoid87 commented 9 years ago

Not working for my MacBook mid-2009 with Yosemite 10.10.1

arkanoid$ spoof-mac.py list --wifi "Wi-Fi" on device "en1" with MAC address F8:1G:DF:E6:66:88 arkanoid $ sudo spoof-mac.py set 0b:4e:08:27:7e:17 en1 arkanoid $ spoof-mac.py list --wifi "Wi-Fi" on device "en1" with MAC address F8:1G:DF:E6:66:88

:(

arkanoid$ spoof-mac.py --version 2.0.0

asmeurer commented 9 years ago

I haven't tested set, but randomize definitely works in Yosemite (I used it at the airport a couple of weeks ago).

arkanoid87 commented 9 years ago

Well, you're right. "Randomize" is working but "set" is not.

prisconapoli commented 9 years ago

Hi all, the issue is due the MAC address you are using. The first byte '0x0b' is an odd number and the address 0b:4e:08:27:7e:17 can't be used for an host. The first byte of a MAC address should be even ( e.g. end in 0, 2, 4, 6, 8, A, C, E). An odd number is generally reserved for special purpose and is typically treated in a different way from network devices (e.g. 0x01 for multicast, 0xff for broadcast). Take a look at http://en.wikipedia.org/wiki/MAC_address for more info.

asmeurer commented 9 years ago

SpoofMAC ought to check for that.

feross commented 9 years ago

@asmeurer Yep, I would accept a PR that checked for valid mac addresses for set. Could you open an issue or send a PR?

ghost commented 9 years ago

Has a fix evolved from the discussion for setting the MAC address?

asmeurer commented 9 years ago

The Wikipedia article no longer seems to have a reference for this (or I didn't find it when skimming through it).

prisconapoli commented 9 years ago

Take a look at the image (on the rigth side) of this link http://en.wikipedia.org/wiki/MAC_address#Address_details.

In few words, the less two significant bits in the first octet of a MAC Address are special flags, used to define some aspects of the address.

The less significant bit is used to differentiate among Unicast (0) or Multicast(1) address, while the second one is used to differentiate among Universally(0) or Locally(1) administrated address.

Generally, in a personal computer, a NIC is set for accepting only unicast (0) address. There are not restriction about universal or local address.

You can use the second bit to communicate that you are no longer using the manufacturer’s burned-in-address (BIA) and that MAC address has been changed locally. So be careful about this bit too, if you want to make a mac spoofing in a proper way.

Hope this help, P.

ghost commented 9 years ago

These are already well known principles about MAC addresses. The question is implementing these principles in the program so that the set command works.

2015-03-27 2:31 GMT-07:00 Prisco Napoli notifications@github.com:

Take a look at the image (on the rigth side) of this link http://en.wikipedia.org/wiki/MAC_address#Address_details.

In few words, the less two significant bits in the first octet of a MAC Address are special flags, used to define some aspects of the address.

The less significant bit is used to differentiate among Unicast (0) or Multicast(1) address, while the second one is used to differentiate among Universally(0) or Locally(1) administrated address.

Generally, in a personal computer, a NIC is set for accepting only unicast (0) address. There are not restriction about universal or local address.

You can use the second bit to communicate that you are no longer using the manufacturer’s burned-in-address (BIA) and that MAC address has been changed locally. So be careful about this bit too, if you want to make a mac spoofing in a proper way.

Hope this help, P.

— Reply to this email directly or view it on GitHub https://github.com/feross/SpoofMAC/issues/36#issuecomment-86880003.

pteek commented 9 years ago

How about a verify function that will check and correct to always return a valid mac address to spoof?

It can be called just before setting a new mac weather it is random or user given.

Edit: What should be the behavior for UA or LA bit?

ghost commented 9 years ago

whether* An if else should work but it might be easier to let the code run until a valid one results, lest the code become large (i.e., a corrective function might not be necessary).

2015-03-27 8:12 GMT-07:00 pteek notifications@github.com:

How about a verify function that will check and correct to always return a valid mac address to spoof?

It can be called just before setting a new mac weather it is random or user given.

— Reply to this email directly or view it on GitHub https://github.com/feross/SpoofMAC/issues/36#issuecomment-86969352.

pteek commented 9 years ago

For arkanoid87 above, he was spoofing a manually specified address which had the multicast bit set, so we have to handle the case when a user makes this mistake.

We can either change the MAC address silently or warn the user. In any case, we will need a validate function (5 lines).

TkTech commented 9 years ago

The set function is working as intended - a verifier that warns but doesn't forbid the user is probably best. If I want to explicitly set a mac address nothing should prevent me from doing so.

For the randomize function, it should definitely generate one that verifies.

pteek commented 9 years ago

Okay, I'll write one verifying function. Make randomize always return a valid mac address. And add warning code to the script.

One thing, should the randomly generated address be LA or UA?

Edit: Okay, we have a flag for LA or UA. Neat.

pteek commented 9 years ago

Randomize has a fixed OUI prefix in the vmware range. It always generates a unicast address.

We only need to warn the user if he enters a multicast address.

ghost commented 9 years ago

I agree. The function manipulate MAC addresses when a user enters a multicast address is unnecessary so warning the user makes the most sense.

2015-03-27 9:01 GMT-07:00 pteek notifications@github.com:

Randomize has a fixed OUI prefix in the vmware range. It always generates a unicast address.

We only need to warn the user if he enters a multicast address.

— Reply to this email directly or view it on GitHub https://github.com/feross/SpoofMAC/issues/36#issuecomment-86988802.

pteek commented 9 years ago

PR merged.

https://github.com/feross/SpoofMAC/pull/44

ghost commented 9 years ago

Awesome . . .

2015-03-27 9:37 GMT-07:00 pteek notifications@github.com:

PR merged.

— Reply to this email directly or view it on GitHub https://github.com/feross/SpoofMAC/issues/36#issuecomment-87001321.

prisconapoli commented 9 years ago

well done :)

feross commented 9 years ago

Just published 2.0.4 with this improvement.

jpalcantara commented 9 years ago

Hello, I installed the following on my mac book running 10.10.4 pip install SpoofMAC and easy_install SpoofMAC and I also wanted to automate this. if I run sudo spoof-mac.py randomize en1 it does what it does then I run spoof-mac.py list and shows what it's supposed to. But I installed the Startup Installation . And restarted my system and there is no changes on the WIFI card and also is the local.macspoof.plist supposed to be empty?