Modifying a QingPing Air Quality Monitor for Local MQTT Access
The QingPing Air Quality Monitor 2 is an Android-based device that not only features a touch screen with the current air quality statistics of the room, but also includes an MQTT interface that normally is used in combination with the QingPing mobile app and the Xiaomi IoT ecosystem. Changing it to report to a local MQTT server instead for integration with e.g. Home Assistant can be done in an official way that still requires creating a cloud account, or you can just do it yourself via an ADB shell and some file modifications as [ea] has done.
By default these devices do not enumerate when you connect a computer to their USB-C port, but that’s easily resolved by enabling Android’s developer mode. This involves seven taps on the Device Name line in the About section of settings. After this you can enter Developer Options to toggle on Debug Mode and Adbd Debugging, which creates the option to connect to the device via USB with ADB and open up a shell with adb shell.
From there you can shoot off the QingSnow2 app and the watchdog.sh that’s running in the background, disable IPv6 and edit /etc/host to redirect all the standard cloud server calls to a local server. Apparently there is even SSH access at this point, with root access and password rockchip. The MQTT configuration is found under /data/etc/ in settings.ini, which is used by the QingPing app, so editing redirects all that.
Of course, the device also queries a remote server for weather data for your location, so if you modify this you have to provide a proxy, which [ea] did with a simple MQTT server that’s found along with other files on the GitHub project page.
Arch
in reply to Filippo Valsorda • • •bo0tzz
in reply to Filippo Valsorda • • •bo0tzz
in reply to bo0tzz • • •Arch
in reply to bo0tzz • • •git.gmem.ca/arch/filo-test-vectorsavailable if you want to pull it, otherwise paste.gmem.ca/paste/a3f8165d-5…Filippo Valsorda
in reply to Arch • • •thank you both!! I've added the Dockerfile to the gist.
I'll update you when we find all four seeds.
Royce Williams
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Royce Williams • • •Royce Williams
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Royce Williams • • •Royce Williams
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Royce Williams • • •Royce Williams
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Royce Williams • • •magical
in reply to Filippo Valsorda • • •Royce Williams
in reply to Royce Williams • • •Feature request: have the clients periodically report work rate to the server, so you can calculate aggregate work rate on the server side?
(also: +48 physical cores at your service!)
Filippo Valsorda
in reply to Royce Williams • • •Royce Williams
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Royce Williams • • •mei likes this.
Royce Williams
in reply to Filippo Valsorda • • •Flávio Heleno
in reply to Filippo Valsorda • • •#>
in reply to Filippo Valsorda • • •Adam Shostack
in reply to Filippo Valsorda • • •I mean, I've heard Heroku called "RCE as a service" but this is next level! ;)
Also, are you going to share the bitcoin?
😂
210561 ✨ [Q]
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to 210561 ✨ [Q] • • •@q ❤
The P50 to find one of the results is 5-10 core-years, but we might get lucky/unlucky.
(All four results are searched at the same time, but finding all 4 makes the tail longer.)
210561 ✨ [Q]
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to 210561 ✨ [Q] • • •Maartje
in reply to Filippo Valsorda • • •Royce Williams
in reply to Filippo Valsorda • • •Core counts I caught so far:
@me: ~200
@arch: 7
@tychotithonus: 48
@pkhuong: 200
@q: 512
@maartje: 30
@davidwilemski: 36
@kalebpace: 36
@flavioheleno: "a few"
@wanderling: 48
See also:
bsky.app/profile/filippo.abyss…
(thanks, @arch !)
Filippo Valsorda
Unknown parent • • •Paul Khuong
in reply to Filippo Valsorda • • •+200 for a couple days
EDIT: "2^32 estimated in 19.26 core-years" oof. for a month then ;)
mstar
Unknown parent • • •lowdefinition
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Filippo Valsorda • • •Hell yeah, we got the first (of four) hit! So relieved this is working.
It's the easiest to find case: a double rejection which has probability (2^-16 + 2^-16)² = 2^-30.
We should see a handful of these before we hit the other two ~2^-31 cases and the (2^-16)² = 2^-32 case.
Filippo Valsorda
in reply to Filippo Valsorda • • •There are 1,621 instances running, that I know of. (There is no reporting.)
1,269 are from Fediverse users.
At this pace, we should have a 50% chance of hitting the 2^-32 case every 2.25 days.
We found the 2^-30 case in ~10h, which more or less tracks.
Filippo Valsorda
in reply to Filippo Valsorda • • •We also got a seed for 2^30 ≤ GCD(p - 1, q - 1) < 2^31 🥳
This was a 2^-30.7 case, less likely than the previous one.
Now we are missing:
2^31 ≤ GCD(p - 1, q - 1) < 2^32 ← 2^-31.7 chance
GCD(p - 1, q - 1) ≥ 2^32 ← 2^-31.7 chance
GCD(p - 1, e) ≠ 1 && GCD(q - 1, e) ≠ 1 ← 2^-32 chance
Arian
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Filippo Valsorda • • •We got no reports for 20 hours, and then in six hours we got another 2^-30 case and not one but two 2^31 ≤ GCD(p - 1, q - 1) < 2^32 hits!
Random searches be like that.
Unfortunately, we are still looking for a GCD(p - 1, q - 1) ≥ 2^32 which is critical to test the rejection path.
We got kinda unlucky, of the 10 GCD(p - 1, q - 1) ≥ 2^30 hits we got, you'd statistically expect 2.5 to be ≥ 2^32.
Filippo Valsorda
in reply to Filippo Valsorda • • •Folks, I can confirm we got all the edge cases! 💥 🥳
My collector screen changed color JUST AS I WAS TYPING that we had found 10 GCDs of 31 bits, 5 GCDs of 32 bits, and one of 34 bits, but none of 33 bits.
I have now written self-tests for the Python test generator and added tests to the Go tests, to be sure. github.com/C2SP/C2SP/pull/197/…
Thank you so much to everyone who contributed to the > 8,500(!) cores. I would like to credit you, so either reply or DM me your name/handle, if you'd like.
det-keygen: add RSA deterministic key generation by FiloSottile · Pull Request #197 · C2SP/C2SP
GitHubMaartje
in reply to Filippo Valsorda • • •René Moser (resmo) レネ
in reply to Filippo Valsorda • • •🥳
René Moser @resmo
just a bunch of spare cpus.
bene
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Filippo Valsorda • • •Here are some statistics (estimated via Poisson inference on the observed hit counts):
Keys generated: 2^34.5 (95% CI: 2^33.6–2^35.0)
Core-years: 56.7 (95% CI: 30.7–82.6)
Average cores: ~5,200 (95% CI: 2,800–7,500)
This is a lot, folks! Really grateful for this level of community support.
Joonas Kuorilehto
in reply to Filippo Valsorda • • •爪卂尺匚-卂ㄩ尺乇ㄥ乇
in reply to Filippo Valsorda • • •Moritz Dietz
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to Moritz Dietz • • •Moritz Dietz
in reply to Filippo Valsorda • • •Cory Carson
in reply to Filippo Valsorda • • •@moritzdietz 4000 cpu?! For volunteer work?
Zoinks, that's a big fish!
Otto Sulin
in reply to Filippo Valsorda • • •Joonas Kuorilehto
in reply to Filippo Valsorda • • •Sure. My CPU isn’t fast but it’s winter and my storage room is heated either by my server or electric heating so I lose nothing 😀
After initial test it uses 30W real electricity (Shelly measured) on 6 cores, saving 30W of power from radiator. Raised platform temps from 15°C to 25°C.
爪卂尺匚-卂ㄩ尺乇ㄥ乇
in reply to Filippo Valsorda • • •2m
in reply to Filippo Valsorda • • •+32 cores running here as well.
Cory Carson
in reply to Filippo Valsorda • • •Timo Savola
in reply to Filippo Valsorda • • •bene
in reply to Filippo Valsorda • • •Bart Coppens
in reply to Filippo Valsorda • • •mei
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to mei • • •@mei yeah whoops that should be "2^32 < gcd(p-1,q-1) < 2^33"
I have already changed it locally, will fix it with the next push.
mei likes this.
kasperd
in reply to Filippo Valsorda • • •Filippo Valsorda
in reply to kasperd • • •kasperd
in reply to Filippo Valsorda • • •If you want safe primes, you need to reject a lot more than half of the prime candidates. The security benefit from safe primes depends on the use case. Maybe your use case doesn’t need them.
Some of the steps you would take when generating safe primes are almost free. For example if you just want to generate a random prime you only need to consider numbers congruent to 1 or 5 mod 6. If you want to generate a random safe prime you only need to consider numbers congruent to 11 mod 12.
Performance wise it makes no difference if you do one or the other. The mod 6 approach automatically skips all candidate p values divisible by 2 or 3, the mod 12 approach additionally skips all candidate p values where (p-1)/2 is divisible by 2 or 3. So I was thinking there might be some benefit from avoiding (p-1)/2 with any small factors even if you don’t need a safe prime. Same principle applies if you use this approach to avoid generating candidates divisible by 5, 7, 11,13 and other small primes. Avoiding small factors in (p-1)/2 doesn’t have an additional cost over just avoiding small factors in p.
It’s only at the point where you do the full primality test that there is a significant cost in doing the primality test on both p and (p-1)/2.
As far as I recall there is a security benefit from avoiding small factors in (p-1)/2 and (q-1)/2 even if you don’t need those to be prime as well. But I don’t recall all the details though.
mei
in reply to kasperd • • •René Moser (resmo) レネ
in reply to Filippo Valsorda • • •Cory Carson
in reply to Filippo Valsorda • • •