Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
jmrozanec__cron-utils_CVE-2021-41269_9-1-5 — cron式の解析、検証、移行、記述のためのJavaライブラリ。複数の形式(Unix、Quartz、Spring)と人間が読めるロケール固有の出力をサポート。 | Kitploit
ツール/GitHubGitHub/shoucheng3/jmrozanec__cron-utils_cve-2021-41269_9-1-5
汎用ユーティリティスクリプトと自動化ユーティリティとフレームワーク学習と教育
GitHubshoucheng3/jmrozanec__cron-utils_cve-2021-41269_9-1-5

jmrozanec__cron-utils_CVE-2021-41269_9-1-5

cron式の解析、検証、移行、記述のためのJavaライブラリ。複数の形式(Unix、Quartz、Spring)と人間が読めるロケール固有の出力をサポート。

リポジトリを見る

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
610ヶ月前未レビュー
共有

cron-utils

私たちはcronを定義し、そしてそれをサポートします。

cron-utils は、cron を定義、解析、検証、移行し、それらの人間が読める説明を取得するための Java ライブラリです。このプロジェクトは セマンティックバージョニング規約 に従い、OSGi メタデータを提供し、Apache 2.0 ライセンスを使用しています。

Gitter Chat Build Status Quality Gate

ダウンロード

cron-utils は Maven central リポジトリで利用できます。

root@kitploit:~
<dependency>
    <groupId>com.cronutils</groupId>
    <artifactId>cron-utils</artifactId>
    <version>9.2.1</version>
</dependency>

Android 開発者の方へ: cron-utils 7.0.0 は Android 26+ を前提としています。それ以前の Android バージョンでは cron-utils 6.0.6 の使用を検討してください。 Java EE の ScheduleExpression を使用する場合、これは実行時依存関係として提供する必要があります。

現在の開発状況

現在、JDK 16 に向けてコードベースを更新中です。リリース時に JDK 17 と完全に互換性があることを確認します。

現在、ニューラル翻訳を使用した次世代の cron 記述子を開発中です! データセット生成の支援から機械学習モデルのトレーニング、それらのロード用ユーティリティまで、あらゆる種類の貢献を歓迎します! 興味があれば、issue #3 をフォローしてください。

特徴

  • 任意の cron 式を作成: 独自の cron 形式を定義できます! サポートされているフィールドは、秒、分、時、日(月)、月、曜日、年です。
  • 最後のフィールドをオプションとしてフラグ付けできます!
  • すべての cron 特殊文字をサポート: * / , -
    • 非標準文字 L、W、LW、'?' および # もサポートされています!
  • cron 拡張 / ニックネームをサポート: @yearly、@annually、@monthly、@weekly、@daily、@midnight、@hourly、@reboot
  • ロケール固有の人間が読める形式で出力 (中国語、英語、ドイツ語、ギリシャ語、インドネシア語、日本語、韓国語、ポーランド語、ルーマニア語、スペイン語、スワヒリ語、トルコ語は完全にサポートされています。オランダ語、フランス語、イタリア語、ポルトガル語、ロシア語は基本的なサポートがあります)。
  • 解析と説明のプロセスは分離されています: 一度解析して、結果を操作できます!
  • CronBuilder を使用して cron 式を構築:
    • 各 cron プロバイダーのフィールドと制約を覚えておく必要はありません。
    • cron は cron プロバイダーから分離されます: いつでも別の形式にエクスポートできます。
  • cron 式が等しいかどうかを確認します。
  • 複数の cron 式を1つにまとめます!
  • cron 文字列式が cron 定義と一致するかを検証します。
  • 異なる cron 定義間で cron を変換: 式を移行する必要がある場合、CronMapper が役立ちます!
  • 次の cron ライブラリの定義済み定義が提供されています:
    • Unix
    • Cron4j
    • Quartz
    • Spring。v5.3 より前と v5.3 以降 の2つの定義をサポートしています。
  • 最後/次の実行時間、および最後の実行からの時間 / 次の実行までの時間を取得します。
  • 2日間の実行回数を計算し、実行頻度に基づいて cron を比較します。
  • 異なる週末ポリシーや祝日を考慮して、2つの日付間の曜日数を取得します。
  • 異なる cron / 時間ライブラリ間で定数をマッピングする必要がありますか? ConstantsMapper を使用してください。

使用例

以下にいくつかの例を示します。これらおよびその他の例は、cron-utils ライブラリを紹介するために作成した サンプルリポジトリ にあります!

cron 定義の構築

root@kitploit:~
// Define your own cron: arbitrary fields are allowed and last field can be optional
CronDefinition cronDefinition =
    CronDefinitionBuilder.defineCron()
        .withSeconds().and()
        .withMinutes().and()
        .withHours().and()
        .withDayOfMonth()
            .supportsHash().supportsL().supportsW().and()
        .withMonth().and()
        .withDayOfWeek()
            .withIntMapping(7, 0) //we support non-standard non-zero-based numbers!
            .supportsHash().supportsL().supportsW().and()
        .withYear().optional().and()
        .instance();

// or get a predefined instance
cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);

cron 式の構築

root@kitploit:~
// Create a cron expression. CronMigrator will ensure you remain cron provider agnostic
import static com.cronutils.model.field.expression.FieldExpressionFactory.*;

Cron cron = CronBuilder.cron(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ))
    .withYear(always())
    .withDoM(between(SpecialChar.L, 3))
    .withMonth(always())
    .withDoW(questionMark())
    .withHour(always())
    .withMinute(always())
    .withSecond(on(0))
    .instance();
// Obtain the string expression
String cronAsString = cron.asString(); // 0 * * L-3 * ? *

解析

root@kitploit:~
// Create a parser based on provided definition
CronParser parser = new CronParser(cronDefinition);
Cron quartzCron = parser.parse("0 23 * ? * 1-5 *");

... さらにマルチ cron 式も! 複数の cron を1行にまとめてみませんか? 0 0 9 * * ? *、0 0 10 * * ? *、0 30 11 * * ? *、0 0 12 * * ? * と書く代わりに、0 0|0|30|0 9|10|11|12 * * ? * にまとめることができます。

説明

root@kitploit:~
// Create a descriptor for a specific Locale
CronDescriptor descriptor = CronDescriptor.instance(Locale.UK);

// Parse some expression and ask descriptor for description
String description = descriptor.describe(parser.parse("*/45 * * * * ?"));
// Description will be: "every 45 seconds"

description = descriptor.describe(quartzCron);
// Description will be: "every hour at minute 23 every day between Monday and Friday"
// which is the same description we get for the cron below:
descriptor.describe(parser.parse("0 23 * ? * MON-FRI *"));

移行

root@kitploit:~
// Migration between cron libraries has never been so easy!
// Turn cron expressions into another format by using CronMapper:
CronMapper cronMapper = CronMapper.fromQuartzToCron4j();

Cron cron4jCron = cronMapper.map(quartzCron);
// and to get a String representation of it, we can use
cron4jCron.asString();//will return: 23 * * * 1-5

検証

root@kitploit:~
cron4jCron.validate()

実行からの / までの時間計算

root@kitploit:~
// Get date for last execution
ZonedDateTime now = ZonedDateTime.now();
ExecutionTime executionTime = ExecutionTime.forCron(parser.parse("* * * * * ? *"));
ZonedDateTime lastExecution = executionTime.lastExecution(now);

// Get date for next execution
ZonedDateTime nextExecution = executionTime.nextExecution(now);

// Time from last execution
Duration timeFromLastExecution = executionTime.timeFromLastExecution(now);

// Time to next execution
Duration timeToNextExecution = executionTime.timeToNextExecution(now);

ライブラリ間の定数マッピング

root@kitploit:~
// Map day of week value from Quartz to JodaTime
int jodatimeDayOfWeek =
        ConstantsMapper.weekDayMapping(
                ConstantsMapper.QUARTZ_WEEK_DAY,
                ConstantsMapper.JODATIME_WEEK_DAY
        );

人間のための日付と時刻のフォーマット!

htime を使用してください - Java のための人間が読める日時フォーマット! この機能は同じ jar にバンドルされていませんが、cron-utils プロジェクトの一部であり、役立つかもしれません。

root@kitploit:~
// You no longer need to remember "YYYY-MM-dd KK a" patterns.
DateTimeFormatter formatter = 
	    HDateTimeFormatBuilder
		    .getInstance()
		    .forJodaTime()
		    .getFormatter(Locale.US)
		    .forPattern("June 9, 2011");
String formattedDateTime = formatter.print(lastExecution);
// formattedDateTime will be lastExecution in "dayOfWeek, Month day, Year" format

cron-utils CLI

新しいプロジェクトを作成せずに、コンソールから直接 cron-utils を使用するためのシンプルな CLI インターフェースを提供しています! CLI はサテライトプロジェクトであり、cron-utils-cli で利用できます。

  • 使用法: java -jar cron-utils.jar com.cronutils.cli.CronUtilsCLI --validate -f [CRON4J|QUARTZ|UNIX] -e '<cron expression>'

  • 例: java -jar cron-utils.jar com.cronutils.cli.CronUtilsCLI --validate -f UNIX -e '* 1 * * *'

'cp' を必要としないスタンドアロン jar が必要な場合は、以下のコマンドで uber jar をビルドします:

root@kitploit:~
mvn assembly:assembly -DdescriptorId=jar-with-dependencies

次に、(target ディレクトリにビルドされた) cli-utils を次のコマンドで起動します:

root@kitploit:~
java -jar cron-utils-<version>-jar-with-dependencies.jar com.cronutils.cli.CronUtilsCLI --validate -f [CRON4J|QUARTZ|UNIX] -e '<cron expression>'`

貢献とサポート!

貢献を歓迎します! 以下の方法で貢献できます

  • このリポジトリにスターを付ける!
  • 新機能のリクエストや追加。 ロードマップ をチェックしてください!
  • 既存のコードの強化: 例: より正確な説明ケースの提供
  • テスト
  • ドキュメントの強化
  • 新しいロケールをサポートするための翻訳の提供
  • 提案やバグ報告
  • 情報の拡散
  • どのように使用しているか教えてください! wiki に掲載 されるのを楽しみにしています!

私たちのページ をチェックしてください! プロジェクトの統計については、OpenHUB プロフィール を参照できます。

その他の cron-utils プロジェクト

以下の cron-utils プロジェクトもぜひご覧ください:

  • htime: 人間が日付を簡単にフォーマットできるようにする Java ライブラリ。日時フォーマット文字を覚えておく必要はもうありません。例を書くだけで、適切なフォーマッタが得られます。
  • cron-utils-spring: cron-utils を使用して、Spring フレームワークで cron 式を人間が読める言語で記述するための Java ライブラリ。
  • cron-utils-cli: cron-utils の機能を CLI から利用できるようにしたもの。
  • cron-utils-sisyphus: 複数の cron 表記をサポートする Scala スケジューラ。
  • cron-utils-scheduler: cron-utils ライブラリに基づく Java ジョブスケジューラ。
ツールをダウンロード