2 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
13 * This program is copyright Alec Muffett 1993. The author disclaims all
14 * responsibility or liability with respect to it's usage or its effect
15 * upon hardware or computer systems, and maintains copyright as set out
16 * in the "LICENCE" document which accompanies distributions of Crack v4.0
27 #include <sys/types.h>
34 #define PWADMIN "/etc/default/passwd"
35 #define TRUNCSTRINGSIZE (PATH_MAX/4)
36 #define STRINGSIZE PATH_MAX
42 #define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS)
47 uint32_t pih_numwords
;
48 uint16_t pih_blocklen
;
59 #define PFOR_WRITE 0x0001
60 #define PFOR_FLUSH 0x0002
61 #define PFOR_USEHWMS 0x0004
65 struct pi_header header
;
68 char data
[NUMWORDS
][MAXWORDLEN
];
71 #define PW_WORDS(x) ((x)->header.pih_numwords)
72 #define PIH_MAGIC 0x70775632
74 void PWRemove(char *);
75 PWDICT
*PWOpen(char *, char *);
76 char *Mangle(char *, char *);
78 #define CRACK_TOLOWER(a) (isupper(a)?tolower(a):(a))
79 #define CRACK_TOUPPER(a) (islower(a)?toupper(a):(a))
80 #define STRCMP(a, b) strcmp((a), (b))
82 char *Trim(register char *);
83 uint32_t FindPW(PWDICT
*, char *);
84 int PWClose(PWDICT
*);
85 int PutPW(PWDICT
*, char *);
86 char Chop(register char *);
87 char Chomp(register char *);
88 char *GetPW(PWDICT
*, uint32_t);
90 #define DATABASE_OPEN_FAIL -1
91 #define DICTIONARY_WORD 2
92 #define REVERSE_DICTIONARY_WORD 3
95 /* Dictionary database dir and prefix */
97 #define CRACK_DIR "/var/passwd"
98 #define CRACK_DICTPATH "/var/passwd/pw_dict"
99 #define DICT_DATABASE_HWM "pw_dict.hwm"
100 #define DICT_DATABASE_PWD "pw_dict.pwd"
101 #define DICT_DATABASE_PWI "pw_dict.pwi"
103 int packer(char *, char *);
104 char *Reverse(char *);
105 char *Lowercase(char *);
106 int DictCheck(char *, char *);
107 int make_dict_database(char *, char *);
108 int build_dict_database(char *, char *);
112 /* Return values for dictionary database checks */
114 #define NO_DICTDATABASE 1
115 #define UPDATE_DICTDATABASE 2
116 #define DICTFILE_ERR -1
117 #define DICTPATH_ERR -2
118 #define DICTDATABASE_BUILD_ERR -3
124 #endif /* _PACKER_H */