如何使用“crunch”生成字符串范围“9811@000000#” - “9811@999999#”?

如何使用“crunch”生成字符串范围“9811@000000#” - “9811@999999#”?

如何使用生成以下内容crunch

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

我尝试了这个但是失败了:

crunch 12 12 1234567890 -t '9811@'@@@@@@# -l 9811@@@@@@@# 

答案1

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

因此,您应该将模式改为-t

  • 决赛@@@@@@%%%%%%

并以如下模式运行-l

  • 9811@@@@@@
  • @@@@@@随便(比如说aaaaaa
  • #@

1234567890不再需要,因为您不需要替换字符:

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#

相关内容