OSQueryでOSの情報がSQLでとれる

osquery.io

OSQuery知らなかった。Facebookは個人情報面ではEvilなところがあるけど、作るOSSは良いものがある。

macならbrewで入る。ただしboostやらいろいろな依存ライブラリを入れるので結構時間がかかる。

必要になったらもっと調べたいけどとりあえず

> osqueryi

インタラクティブシェルに入って

osquery> select * from os_version;
+----------+---------+-------+-------+-------+--------+----------+---------------+----------+
| name     | version | major | minor | patch | build  | platform | platform_like | codename |
+----------+---------+-------+-------+-------+--------+----------+---------------+----------+
| Mac OS X | 10.14.3 | 10    | 14    | 3     | 18D109 | darwin   | darwin        |          |
+----------+---------+-------+-------+-------+--------+----------+---------------+----------+
osquery> select percent_remaining from battery;
+-------------------+
| percent_remaining |
+-------------------+
| 100               |
+-------------------+

とか。

参考

Auditing containers with osquery – ITNEXT