Skip to content
KitploitKITPLOIT
StrumentiBlog
Invia
StrumentiBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

··Feed·Contatto·Privacy·© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
exrex — Metodi irregolari sulle espressioni regolari | Kitploit
Strumenti/GitHubGitHub/asciimoo/exrex
Utilità GenericheGenerazione di PayloadFuzzing
GitHubasciimoo/exrex

exrex

Metodi irregolari sulle espressioni regolari

Vedi Repository
957988 mesi faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

EXREX

Metodi irregolari per espressioni regolari.

Exrex è uno strumento da riga di comando e un modulo python che genera tutte - o casuali - stringhe corrispondenti a una data espressione regolare e altro ancora. È puro python, senza dipendenze esterne.

Ci sono espressioni regolari con infinite stringhe corrispondenti (es.: [a-z]+), in questi casi exrex limita la lunghezza massima delle parti infinite.

Exrex utilizza generatori, quindi l'uso della memoria non dipende dal numero di stringhe corrispondenti.

Version Downloads

Caratteristiche

  • Genera tutte le stringhe corrispondenti
  • Genera una stringa corrispondente casuale
  • Conta il numero di stringhe corrispondenti
  • Semplificazione delle espressioni regolari

Installazione

Per installare exrex, basta:

root@kitploit:~
$ pip install exrex

o

root@kitploit:~
$ easy_install exrex

Utilizzo

come modulo 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])

Utilizzo da riga di comando

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

Esempi:

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

Bug

Bug o suggerimenti? Visita il tracker dei problemi.

Documentazione

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

TODO

  • Opzioni da riga di comando per cambiare set di caratteri/intervalli/limiti predefiniti (es. per '.','\s'..) (40%)
  • Estendere le categorie (re.sre_parse.CATEGORIES) (30%)
  • Migliorare setup.py
  • Codice più verboso
  • Documentazione
  • Ottimizzazioni
  • Generazione di n diverse stringhe corrispondenti casuali
  • Riduzione dell'uso della memoria (100%?) - generatori
  • Conteggio del numero di stringhe corrispondenti - (100%?)
  • Supporto Unicode (100%)
  • Gestire grouprefs (100%)
  • Compatibilità Python3 (100%) ( >= python3.3)

Licenza

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]>

Fun/arte

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

Progetti simili

Strumenti che generano un elenco di tutte le possibili stringhe corrispondenti a un dato pattern:

  • regldg (include una demo live sul sito)
  • regex-genex (supporta l'uso simultaneo di più pattern regex)

Strumenti che generano stringhe casuali, una per una, corrispondenti a un dato pattern:

  • randexp.js (include diverse demo live sul sito)
  • rstr.xeger (un metodo del modulo Python rstr)

Profilazione

  • 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
Scarica lo strumento