Como eu gero o intervalo de strings “9811 @ 000000 #” - “9811 @ 999999 #” usando 'crunch'?

-5

Como faço para gerar o seguinte usando crunch ?

9811@000000# 
9811@000001#
9811@000002#
9811@000003#
...
9811@999999#

Eu tentei isso, mas falhou:

crunch 12 12 1234567890 -t '9811@'@@@@@@# -l 9811@@@@@@@# 
    
por nazar2sfive 05.02.2016 / 09:10

1 resposta

2

De man crunch :

       -t @,%^
              Specifies a pattern, eg: @@god@@@@ where the only the @'s, ,'s,
              %'s, and ^'s will change.
              @ will insert lower case characters
              , will insert upper case characters
              % will insert numbers
              ^ will insert symbols
       -l When you use the -t option this option tells crunch  which  symbols
              should  be treated as literals.  This will allow you to use the
              placeholders as letters in the pattern.  The -l  option  should
              be the same length as the -t option.  See example 15.
       Example 15
       crunch 7 7 -t p@ss,%^ -l a@aaaaa
       crunch  will  now  treat  the  @ symbol as a literal character and not
       replace the character with a uppercase letter.
       this will generate
       p@ssA0!
       p@ssA0@
       p@ssA0#
       p@ssA0$
       <skipped>
       p@ssZ9

Portanto, você deve alterar o padrão para -t :

  • o final @@@@@@ com %%%%%%

e no padrão para -l :

  • 9811@ com @@@@@
  • @@@@@@ com o que quer que seja (digamos aaaaaa )
  • # com @

1234567890 não será mais necessário, já que você não substituirá os caracteres:

crunch 12 12 -t 9811@%%%%%%# -l @@@@@aaaaaa@
% crunch 12 12 -t 9811@%%%%%%# -l @@@@@aaaaaa@ | head -n 10
Crunch will now generate the following amount of data: 13000000 bytes
12 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 1000000 
9811@000000#
9811@000001#
9811@000002#
9811@000003#
9811@000004#
9811@000005#
9811@000006#
9811@000007#
9811@000008#
9811@000009#
    
por kos 05.02.2016 / 10:02