osquery cronの情報を抽出する

osquery cronの情報を抽出する

osqueryで、cronの情報を抽出するクエリを記述してます。

環境

  • OS Ubuntu20.04
  • osquery 4.8.0

cronの情報を抽出

osqueryiを実行して、対話モードでクエリを実行します。

osqueryi

ronの情報を抽出するには、以下のクエリを実行します。

osquery> select * from crontab;

<出力結果>
+-------+--------+------+--------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------+
| event | minute | hour | day_of_month | month | day_of_week | command                                                                                                                     | path                    |
+-------+--------+------+--------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------+
|       | 17     | *    | *            | *     | *           | root cd / && run-parts --report /etc/cron.hourly                                                                            | /etc/crontab            |
|       | 25     | 6    | *            | *     | *           | root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )                                            | /etc/crontab            |
|       | 47     | 6    | *            | *     | 7           | root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )                                           | /etc/crontab            |
|       | 52     | 6    | 1            | *     | *           | root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )                                          | /etc/crontab            |
|       | 30     | 7-23 | *            | *     | *           | root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi | /etc/cron.d/anacron     |
|       | 30     | 3    | *            | *     | 0           | root test -e /run/systemd/system || SERVICE_MODE=1 /usr/lib/x86_64-linux-gnu/e2fsprogs/e2scrub_all_cron                     | /etc/cron.d/e2scrub_all |
|       | 10     | 3    | *            | *     | *           | root test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r                                                  | /etc/cron.d/e2scrub_all |
+-------+--------+------+--------------+-------+-------------+-----------------------------------------------------------------------------------------------------------------------------+-------------------------+