> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ja/privesc/cron-jobs/cron-expression-calculator.md).

# cron 式計算機

一般的なスケジュール、フィールド構文、特殊文字列、権限昇格の確認メモのための cron 式計算機。

次のような cron 式を検索します `* * * * *`, `*/5 * * * *`, `0 0 * * *`や `@reboot` スケジュールとペンテストのメモを確認するためです。

## Cron Finder

<table data-view="cards" data-full-width="true" data-search="true"><thead><tr><th>式</th><th>意味</th><th>一般的な用途</th><th>レビュー ノート</th></tr></thead><tbody><tr><td><code>* * * * *</code></td><td>毎分</td><td>高速な定期実行タスク</td><td>スクリプトが書き込み可能なら、権限昇格で非常に有用。</td></tr><tr><td><code>*/2 * * * *</code></td><td>2分ごと</td><td>ポーリング タスク</td><td>pspy を使って実行を監視する。</td></tr><tr><td><code>*/5 * * * *</code></td><td>5分ごと</td><td>ヘルスチェック、同期ジョブ</td><td>コマンドのパスと書き込み可能な対象を確認する。</td></tr><tr><td><code>*/10 * * * *</code></td><td>10分ごと</td><td>メンテナンスジョブ</td><td>相対パスと安全でない PATH を探す。</td></tr><tr><td><code>*/15 * * * *</code></td><td>15分ごと</td><td>スケジュールされた同期</td><td>ログとスクリプトの所有権を確認する。</td></tr><tr><td><code>*/30 * * * *</code></td><td>30分ごと</td><td>定期的なクリーンアップ</td><td>削除コマンドとワイルドカードを確認する。</td></tr><tr><td><code>0 * * * *</code></td><td>1時間ごと</td><td>毎時ジョブ</td><td>`/etc/cron.hourly` も確認する。</td></tr><tr><td><code>30 * * * *</code></td><td>毎時30分に</td><td>毎時のオフセット</td><td>30分前後を監視する。</td></tr><tr><td><code>0 */2 * * *</code></td><td>2時間ごと</td><td>バッチタスク</td><td>バックアップおよび同期ディレクトリ内のスクリプトを確認する。</td></tr><tr><td><code>0 0 * * *</code></td><td>毎日0時に</td><td>日次ローテーション</td><td>`/etc/cron.daily` とバックアップスクリプトを確認する。</td></tr><tr><td><code>30 2 * * *</code></td><td>毎日02:30に</td><td>夜間メンテナンス</td><td>root のバックアップジョブでよくある時刻。</td></tr><tr><td><code>0 6 * * *</code></td><td>毎日06:00に</td><td>朝のジョブ</td><td>レポート生成とクリーンアップのスクリプトを確認する。</td></tr><tr><td><code>0 0 * * 0</code></td><td>毎週日曜日の0時に</td><td>週次ジョブ</td><td>`/etc/cron.weekly` を確認する。</td></tr><tr><td><code>0 0 * * 1</code></td><td>毎週月曜日の0時に</td><td>週次ジョブ</td><td>平日用スクリプトを確認する。</td></tr><tr><td><code>0 0 1 * *</code></td><td>毎月1日</td><td>月次レポート</td><td>`/etc/cron.monthly` を確認する。</td></tr><tr><td><code>0 0 1 1 *</code></td><td>毎年1月1日の0時に</td><td>年次タスク</td><td>頻度は低いが root で実行されることがある。</td></tr><tr><td><code>0 9-17 * * 1-5</code></td><td>月曜日〜金曜日の09:00から17:00まで毎時</td><td>営業時間内の自動化</td><td>管理ジョブで使われるユーザー所有のスクリプトを確認する。</td></tr><tr><td><code>*/15 9-17 * * 1-5</code></td><td>営業時間中の15分ごと</td><td>業務時間内のポーリング</td><td>pspy の良い監視対象時間帯。</td></tr><tr><td><code>0 0,12 * * *</code></td><td>0時と12時に</td><td>1日2回のジョブ</td><td>カンマ区切りの時刻。</td></tr><tr><td><code>0 3 * * 1,3,5</code></td><td>月・水・金の03:00に</td><td>スケジュールされたバッチ</td><td>曜日の一致を確認する。</td></tr><tr><td><code>@reboot</code></td><td>システム起動時</td><td>起動スクリプト</td><td>永続化と書き込み可能な起動コマンドを確認する。</td></tr><tr><td><code>@hourly</code></td><td>1時間に1回</td><td>毎時のショートカット</td><td>`0 * * * *` と同等。</td></tr><tr><td><code>@daily</code></td><td>1日1回</td><td>日次のショートカット</td><td>`0 0 * * *` と同等。</td></tr><tr><td><code>@weekly</code></td><td>1週間に1回</td><td>週次のショートカット</td><td>`0 0 * * 0` と同等。</td></tr><tr><td><code>@monthly</code></td><td>1か月に1回</td><td>月次のショートカット</td><td>`0 0 1 * *` と同等。</td></tr><tr><td><code>@yearly</code></td><td>1年に1回</td><td>年次のショートカット</td><td>`0 0 1 1 *` と同等。</td></tr></tbody></table>

## フィールド計算機

```
* * * * *
| | | | |
| | | | +-- 曜日: 0-7、日曜日は 0 または 7
| | | +---- 月: 1-12
| | +------ 日: 1-31
| +-------- 時間: 0-23
+---------- 分: 0-59
```

| 演算子 | 意味   | 例                        |
| --- | ---- | ------------------------ |
| `*` | 任意の値 | `* * * * *` 毎分           |
| `,` | 値の一覧 | `0 0,12 * * *` 0時と12時    |
| `-` | 範囲   | `0 9-17 * * *` 09〜17時の毎時 |
| `/` | ステップ | `*/5 * * * *` 5分ごと       |

## 列挙コマンド

```bash
crontab -l
cat /etc/crontab
ls -la /etc/cron.*
find /etc/cron* -type f -exec ls -la {} \; 2>/dev/null
find /var/spool/cron -type f -exec ls -la {} \; 2>/dev/null
systemctl list-timers --all
```

## 権限昇格チェックリスト

| 確認する                       | 重要性                               |
| -------------------------- | --------------------------------- |
| root によって実行される書き込み可能なスクリプト | 直接的な特権コマンド実行経路                    |
| 相対コマンドパス                   | PATH ハイジャックで実行されるバイナリを制御できる可能性がある |
| 書き込み可能なディレクトリ内のワイルドカード     | 次のようなツールに対するオプションインジェクション `tar`   |
| 全ユーザー書き込み可能な cron ディレクトリ   | ファイル配置やスクリプトの置き換え                 |
| root ジョブがユーザーファイルを処理する     | 入力ファイル経由のパーサーまたはコマンドインジェクション      |
| 完全なパスがない                   | 環境依存の動作                           |
| ログがスケジュールを明らかにする           | 時刻検証と証拠収集に役立つ                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/privesc/cron-jobs/cron-expression-calculator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
