390 points · by herbertl · 1y ago · 267 comments
sudo.exec("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 -z && ifconfig en0 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`",47MB for the UI & boilerplate around the business logic.
I get that this may be the easiest way to develop and publish an application today, but it's sad that this is the direction we have taken in recent years.
Business logic size: ~20 bytes Total app size: ~47 MB = 47,000,000 bytes
Bloat factor: 47,000,000 / 20 = 2,350,000
Let’s scale this up and say the business logic is 1 pound.
Then the whole app would weigh: 1 lb × 2,350,000 = 2,350,000 pounds
What weighs ~2.35 million pounds?
- A fully loaded Boeing 747-8: ~987,000 lbs
- Another fully loaded 747-8: ~987,000 lbs
- A blue whale: ~330,000 lbs
TOTAL: ~2,304,000 lbsThe business logic is like shipping a 1 lb object (a book, a flash drive, whatever) by loading it into two fully loaded 747s and strapping a blue whale on top.
Just to run 20 bytes of logic.
And to top it off, the dual flights and whale would need complex orchestration too!
We just call it Kubernetes…
Mass is a nonsense analogy that doesn't reveal anything useful.
That being said, the fact that quick maths can give you a 6 orders of magnitude difference between functional code and the package is probably reason for concern.
The business logic for humans is a single reproductive cell.
A single sperm weighs 2.3 x 10^-11 grams. If the average male weighs 75kg the. The bloat ratio for a human male is 3.2x10^15
Getting back to the app there is huge value in not needing to run the command yourself. Sure it’s wrapped in a UI that comes with “bloat” but honestly who cares. When was the last time someone needed to worry about hard drive space, when it comes to a 40mb file.
I tried to build some of my tools without Electron, it's always a battle of multiple documentations for multiple systems and creating a bespoke system or having to deal with UI documentations that are glorified API references without examples.
The last few tools I built used PhotinoNET, which gave me an electron-esque framework but not bundling it's own chromium, instead using the browser already on the system. And even that required a complicated build script so I can just export a simple flatpak, exe and dmg...
This is not 'an app to change MAC address' but an app to 'overcome WiFi time limits'.
Thing is, most x-platform frameworks still require a big download. Java and Python runtimes are in the same ballpark as Electron.
There's great power in abstraction. Disagree?
Your point is that an operating system, and its shell, all running on a machine, and a collection of apps, are somehow smaller than a wrapper application.
I'm curious the amount of bytes the entire stack, minus the chrome which is the complaint I believe, how many bytes that is. I would say probably a gig.
ps: I love both space stations and Unix
That all said, a simple GUI API provided by the OS for simple programs like this would be nice, just to give the user better feedback on the process. Is it done? Is it doing anything? Did it run correctly? Etc.. Zenity on linux kinda does that but is not guaranteed to be installed...
2) the dev has 64gigs of ram and a newest CPU and doesn't care about performance issues for people on older computers... that's why you need gigs of ram just to read a weather report online.
People who don't like the developers work can always write and publish their own application, of course.
Honestly would not expect anything more from js devs who use macs/windows. I see this so often.
>content-length: 47262814
Sigh...
Is it worth it? Probably not, since this is a single-platform app to start with, but JS+HTML are easy to theme and customize, and Qt is... not quite as simple.
https://en.wikipedia.org/wiki/MAC_address#Unicast_vs._multic...
alias randommac='sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 -z && sudo ifconfig en0 ether $(openssl rand -hex 6 | sed "s/../&:/g; s/:$//")'There is a `airportd.sb` file, which appears to be some permissions based thing in s-expression/LISP. Weird.
Edit: Spun up a macOS 15 VM and I got this:
WARNING: The airport command line tool is deprecated and will be removed in a future release. For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
I guess they weren't kidding.
`networksetup -setairportpower en0 on && [... set MAC ...] && networksetup -setairportpower en0 off`
I think it's pretty safe to assume that modern Macs will always have en0 as the WiFi adapter, but if you wanted, you could use `networksetup -listnetworkserviceorder` to find the associated device.
What would you use instead to build a macOS GUI program with comparable ease? SwiftUI? Python + Tk (using the ancient system Python)? Something like Red?
It will change every time you disconnect/connect
For MacOS (Sequoia+) you can just forget the network and reconnect to get a new MAC address [1].
Android's documentation for if it decides to generate a new address per connection is a little vague [2], but I'm guessing forgetting and reconnecting works as well, you may also need to flip the "Wi-Fi non-persistent MAC randomization" bit in developer settings.
On Windows, flipping the "Random hardware address" switch seems to cause it to generate a new seed/address for me.
[1] https://support.apple.com/en-euro/102509
[2] https://source.android.com/docs/core/connect/wifi-mac-random...
NEW_MAC=$(printf '02:%02x:%02x:%02x:%02x:%02x\n' $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)))
sudo ip link set wlan0 down
sudo ip link set wlan0 address "$NEW_MAC"
sudo ip link set wlan0 up
You should replace `wlan0` with whatever you see in `ip link show` for your wireless interface, for me it is `wlp0s20f3`. I replaced the `openssl rand` command because it was generating some invalid MACs; this is hopefully only valid ones.It’s an illegal address, but most equipment will take it because test devices occasionally come from the factory with that MAC. But higher level stuff might barf on it because it’s technically illegal.
$ sudo ifconfig en0 ether 00:00:00:00:00:01
ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address
edit: but this worked on my external NIC! Network wasn't happy though and DHCP didn't work. Ubiquiti had a funny note about this MAC: "Officially Xerox, but 0:0:0:0:0:0 is more common"As always, ymmv.
On some equipment this may cause a broadcast storm, depending on how they implement things. Cisco equipment with some configs will send a packet to all the ports if it receives a packet and can't figure out where it's supposed to go.
For devices running Android 11 or higher, users can enable non-persistent MAC randomization globally for all Wi-Fi networks (that have MAC randomization enabled) through the developer options screen. The option to enable non-persistent MAC randomization for all profiles is found at Settings > Developer Options > Wi-Fi non-persistent MAC randomization.In practice people put fewer than 256 devices on networks (class C), so they have less than 1/65536 possibility of complete failure. And far less because they have a mix of OUIs.
But yeah, if you put a few hundred or thousand security cameras or other device from a single vendor, all on the same network, conflicts are certainly possible.
MAC conflicts are also a bit nasty to troubleshoot, and less obvious than IP conflicts.
MAC randomization does not have to constrain itself to the lower three bytes; you can randomize the OUI too.
What does Android MAC randomization do with the OUI?
According to this possible hallucination from Google Gemini 2.5 Flash, the OUI is partially randomized too:
- Locally Administered Bit (U/L bit): This bit (the 2nd LSB of the first octet) is forced to '1'.
- Unicast/Multicast Bit (I/G bit): The least significant bit (LSB) of the first octet is usually set to '0' to indicate a unicast address.
- Remaining OUI bits (and the entire lower three bytes): All the other bits in the MAC address, including the remaining bits of the first octet, the entire second and third octets (which are part of the OUI), and the entire last three octets, are randomized.
Me again:
So if two bits are fixed, everyone in the randomized space is randomizing 46 bits, which contains 7.03E+13 addresses.
Practically speaking, it seems that the only way you will ever see a clash arising from the above randomization strategy is if two devices are using the same very poorly seeded PRNG.
sudo ifconfig en0 ether 02:11:22:33:44:55
Just ran into this on icelandair.
Buy a coffee, get a new password, etc.
Their employees' time is more effectively spent making coffee than repeatedly providing low-level tech support for random password problems.
That would let you, for example, clone a MAC address or IP address between your computer and a phone, and maybe automatically resolve contention.
That way, you can split purchased WiFi (such as on a plane) between multiple devices.
You need a router for that, which fortunately is built in to most phones and computers these days.
Is there a specific scenario where time limited wifi is common place?
Stuttgart Airport has 60 minutes.
A lot of airlines now offer free "messaging" - usually just text on common messaging apps like WhatsApp. I've been meaning for years to write some kind of server that could give me useful functionality over chat messages.
Already done:
WhatsApp: https://news.ycombinator.com/item?id=33568994
Facebook Messenger: https://news.ycombinator.com/item?id=9203946
The bigger problem is how utterly useless and unstable the connection is to begin with..
I didn't realize you could spoof MAC addresses on....well....a Mac but it's not something I'd do lightly.
(Edit: punctuation)
But be conscious and thoughtful when using it. Some terms to consider whether they apply to a particular use include "unauthorized access", "circumvention", and "theft of service".