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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
exrex — 正規表現における非標準メソッド | Kitploit
ツール/GitHubGitHub/asciimoo/exrex
汎用ユーティリティペイロード生成ファジング
GitHubasciimoo/exrex

exrex

正規表現における非標準メソッド

リポジトリを見る
957988ヶ月前Kitploit レビュー済み

人気

すべて見る →

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

すべてのツールを探索

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

すべてのツールを見る →
共有

EXREX

正規表現のための不規則な手法

Exrex は、コマンドラインツールおよびPythonモジュールであり、与えられた正規表現に一致するすべての文字列(またはランダムな文字列)を生成します。純粋なPythonで書かれており、外部依存関係はありません。

無限に一致する文字列を持つ正規表現(例: [a-z]+)がありますが、その場合 exrex は無限部分の最大長を制限します。

Exrex はジェネレーターを使用するため、メモリ使用量は一致する文字列の数に依存しません。

Version Downloads

Features

  • 一致するすべての文字列の生成
  • ランダムな一致文字列の生成
  • 一致する文字列数のカウント
  • 正規表現の簡略化

Installation

exrex をインストールするには、次のようにします:

root@kitploit:~
$ pip install exrex

または

root@kitploit:~
$ easy_install exrex

Usage

Pythonモジュールとして

root@kitploit:~
>>> import exrex

>>> exrex.getone('(ex)r\\1')
'exrex'

>>> list(exrex.generate('((hai){2}|world!)'))
['haihai', 'world!']

>>> exrex.getone('\d{4}-\d{4}-\d{4}-[0-9]{4}')
'3096-7886-2834-5671'

>>> exrex.getone('(1[0-2]|0[1-9])(:[0-5]\d){2} (A|P)M')
'09:31:40 AM'

>>> exrex.count('[01]{0,9}')
1023

>>> print '\n'.join(exrex.generate('This is (a (code|cake|test)|an (apple|elf|output))\.'))
This is a code.
This is a cake.
This is a test.
This is an apple.
This is an elf.
This is an output.

>>> print exrex.simplify('(ab|ac|ad)')
(a[bcd])

コマンドラインでの使用

root@kitploit:~
> exrex --help
usage: exrex.py [-h] [-o FILE] [-l] [-d DELIMITER] [-v] REGEX

exrex - regular expression string generator

positional arguments:
  REGEX                 REGEX string

optional arguments:
  -h, --help            show this help message and exit
  -o FILE, --output FILE
                        Output file - default is STDOUT
  -l N, --limit N       Max limit for range size - default is 20
  -c, --count           Count matching strings
  -m N, --max-number N  Max number of strings - default is -1
  -r, --random          Returns a random string that matches to the regex
  -s, --simplify        Simplifies a regular expression
  -d DELIMITER, --delimiter DELIMITER
                        Delimiter - default is \n
  -v, --verbose         Verbose mode

例:

root@kitploit:~
$ exrex '[asdfg]'
a
s
d
f
g

$ exrex -r '(0[1-9]|1[012])-\d{2}'
09-85

$ exrex '[01]{10}' -c
1024

バグ

バグや提案がありますか? issue tracker をご覧ください。

ドキュメント

http://exrex.readthedocs.org/en/latest/

TODO

  • デフォルトの文字セット/範囲/範囲制限を変更するコマンドラインスイッチ (例: '.', '\s' など) (40%)
  • カテゴリの拡張 (re.sre_parse.CATEGORIES) (30%)
  • setup.py の改善
  • より詳細なコード
  • ドキュメント
  • 最適化
  • n 個の異なるランダム一致文字列の生成
  • メモリ使用量の削減 (100%?) - ジェネレーター
  • 一致する文字列数のカウント - (100%?)
  • Unicode サポート (100%)
  • グループ参照の処理 (100%)
  • Python3 互換性 (100%) (>= python3.3)

ライセンス

root@kitploit:~
exrex is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

exrex is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with exrex. If not, see < http://www.gnu.org/licenses/ >.

(C) 2012- by Adam Tauber, <[email protected]>

ファン/アート

  • ボート: exrex '( {20}(\| *\\|-{22}|\|)|\.={50}| ( ){0,5}\\\.| {12}~{39})'
  • 目: exrex '(o|O|0)(_)(o|O|0)'

類似プロジェクト

与えられたパターンに一致するすべての可能な文字列のリストを生成するツール:

  • regldg (ウェブサイトにライブデモがあります)
  • regex-genex (複数の正規表現パターンを同時に使用できます)

与えられたパターンに一致するランダムな文字列を一つずつ生成するツール:

  • randexp.js (ウェブサイトにいくつかのライブデモがあります)
  • rstr.xeger (Pythonモジュール rstr のメソッド)

プロファイリング

  • python -m cProfile exrex.py '[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]' -o /dev/null
  • python -m cProfile exrex.py '[0-9]{6}' -o /dev/null
ツールをダウンロード