For iPhones this only happens when un-associated [1] so this script will probably underestimate the count in public spaces. Although, I'm not sure whether the randomization includes the OUI?
In addition to collecting rogue broadcasts you can create a new virtual wifi interface in Managed mode with an ESSID like "linksys", "attwifi", or "xfinitywifi" (or all three?) and start collecting frames. This will bring out the people who don't broadcast.
I think you are right. In fact, this script might be illegal in some places as was brought to my attention. [1]
Do you know if collecting MAC addresses is illegal in UK? In US there is a statue against "intercepting electronic information" [2] but I'm not sure it applies because I don't know whether the MAC address is "electronic information".
There is some precedent, as Google got in trouble for sniffing packets, but they were actually definitely capturing information (emails/passwords) on un-encrypted networks. [3] In any case, I put a warning on the README.
Actually, it doesn't appear to be illegal (but IANAL).
The UK act applies mostly to trying to gain unathorized access to a computer system or network. If you put up your own wifi network and simply listen to your own interface's traffic, and other people access your network without your authorization, it's actually those devices connecting to your network that would be legally suspect - but intent matters, so the device accidentally connecting means they're not breaking the law.
In the US, sniffing the portion of a network which you do not own or operate is considered illegal wiretapping (or at least, it was at one time; I haven't looked into the most recent court cases). But if you own the network (your network interface in managed mode is basically your own AP), you can sniff it.
Your LICENSE should probably explicitly mention that this tool is for research purposes, that you provide no warranty whatsoever, and that anyone using it should follow all local, state, and federal laws at all times.
[1] http://papers.mathyvanhoef.com/asiaccs2016.pdf