halo / LinkLiar

:link: Link-Layer MAC spoofing GUI for macOS
http://halo.github.io/LinkLiar
MIT License
1.23k stars 84 forks source link

Implement Geo-fencing (or a workaround such as scripting access) #37

Closed ajkblue closed 3 years ago

ajkblue commented 4 years ago

Is it possible to access LinkLiar with a script (such as AppleScript)? I tried looking at it with the accessibility inspector program but I can't seem to get it to work. Basically my use case is that I would like my MAC address to always be random unless I'm at my university, because for the Wi-Fi to work there they require registration with a MAC address and I'd rather not be re-registering my computer every time I connect.

What I would like to do is location based MAC address changing, such as turning it to my manually defined address whenever I'm on their network. I can detect location based changes (or SSID changes) with Little Snitch Profiles, and I'd just like to make those changes using LinkLiar rather than having to manually click it and paste a MAC address in.

halo commented 4 years ago

Hi! I've been wondering if someone has that use-case of location-based MAC address switching. I noticed that WifiSpoof has that feature and I wasn't sure. That is something that I should implement in LinkLiar. But I'm still lagging behind solving the other open issue :)

This should work for you: there is a file called /Library/Application Support/LinkLiar/config.json. The menu bar GUI does nothing else except modify that config file.

At the same time, there is a daemon running (it is running when the LinkLiar GUI is running, or even without the GUI when you turned on "run in background", the latter is probably what you want). That daemon simply observes the config.json file and applies what it finds there whenever the file changes.

So I recommend that you setup in the GUI what you need at work and have a look at what the config file looks like. Then you setup what you want in the GUI when you're not at work and look at the config file again. All you have to do now is write to the config file whichever setup is suitable at a certain time or location.

I'll leave this issue open to remind me that geo-fencing is a feature I'd like to implement.

Let me know if you have questions and thank you for asking!

ajkblue commented 4 years ago

I would love to see this implemented! But what you recommended got me I the right direction.

I got it working using sleepwatcher (so it would run on every computer wakeup) and having it start a script to edit LinkLiars config.json based off of the current network SSID. Basically all it does is replace the contents of LinkLiar's config.json file with a manually defined address when at my university (based off of their SSID), but if it doesn't match that then it just writes back the normal random MAC address config file.

If anyone else wants the scripts used I'd be glad to post the details.

halo commented 3 years ago

I'm closing this for now. I have no intentions of introducing geo-fencing, although I'm open to implementing changing the mac address based on which access point SSIDs are currently detected.