如何查看 apg(自动密码生成器)使用的完整“特殊符号集”

如何查看 apg(自动密码生成器)使用的完整“特殊符号集”

我正在使用apg它来生成密码建议,并使用-M开关来包含特殊键盘字符:

apg -a 1 -n 1 -m 16 -x 16 -M SNCL
where:
-a, algorithm - 0 default pronounceable, 1 random unpronounceable
-n, number of passwords
-m, minimum length
-x, maximum length
-M, mode - S, Special symbol set, N, Numeral symbol set, C, upper Case symbol set, L, Lower case symbol set

许多在线服务对于可以使用哪些特殊字符非常挑剔,所以我希望能够排除那些通常不允许的字符。但为了做到这一点,我需要知道它apg使用哪些字符作为“特殊符号集”。有没有办法从某个地方提取这些数据?理想情况下,如果可能的话,实际的字符而不是描述,例如“%”而不是“百分比”

答案1

据我所知,唯一的方法是参考来源。所有集合的字符似乎都包含在一个静态初始化的数组中struct sym

struct sym smbl[94] = 
{
 {'a', S_SL}, {'b', S_SL}, {'c', S_SL}, {'d', S_SL}, {'e', S_SL}, {'f', S_SL},
 {'g', S_SL}, {'h', S_SL}, {'i', S_SL}, {'j', S_SL}, {'k', S_SL}, {'l', S_SL},
 {'m', S_SL}, {'n', S_SL}, {'o', S_SL}, {'p', S_SL}, {'q', S_SL}, {'r', S_SL},
 {'s', S_SL}, {'t', S_SL}, {'u', S_SL}, {'v', S_SL}, {'w', S_SL}, {'x', S_SL},
 {'y', S_SL}, {'z', S_SL}, {'A', S_CL}, {'B', S_CL}, {'C', S_CL}, {'D', S_CL},
 {'E', S_CL}, {'F', S_CL}, {'G', S_CL}, {'H', S_CL}, {'I', S_CL}, {'J', S_CL},
 {'K', S_CL}, {'L', S_CL}, {'M', S_CL}, {'N', S_CL}, {'O', S_CL}, {'P', S_CL},
 {'Q', S_CL}, {'R', S_CL}, {'S', S_CL}, {'T', S_CL}, {'U', S_CL}, {'V', S_CL},
 {'W', S_CL}, {'X', S_CL}, {'Y', S_CL}, {'Z', S_CL}, {'1', S_NB}, {'2', S_NB},
 {'3', S_NB}, {'4', S_NB}, {'5', S_NB}, {'6', S_NB}, {'7', S_NB}, {'8', S_NB},
 {'9', S_NB}, {'0', S_NB}, {33 , S_SS}, {34 , S_SS}, {35 , S_SS}, {36 , S_SS},
 {37 , S_SS}, {38 , S_SS}, {39 , S_SS}, {40 , S_SS}, {41 , S_SS}, {42 , S_SS},
 {43 , S_SS}, {44 , S_SS}, {45 , S_SS}, {46 , S_SS}, {47 , S_SS}, {58 , S_SS},
 {59 , S_SS}, {60 , S_SS}, {61 , S_SS}, {62 , S_SS}, {63 , S_SS}, {64 , S_SS},
 {91 , S_SS}, {92 , S_SS}, {93 , S_SS}, {94 , S_SS}, {95 , S_SS}, {96 , S_SS},
 {123, S_SS}, {124, S_SS}, {125, S_SS}, {126, S_SS}
};

在哪里

#define S_NB    0x01 /* Numeric */
#define S_SS    0x02 /* Special */
#define S_CL    0x04 /* Capital */
#define S_SL    0x08 /* Small   */
#define S_RS    0x10 /* Restricted Symbol*/

struct sym
 {
  char   ch;
  USHORT type;
 };

因此,您可以编写一些 C 代码来迭代数组,ch如果type等于S_SS,则打印该值,结果如下:

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ 

相关内容