File: dictionary.h

package info (click to toggle)
medussa 0.8-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,004 kB
  • ctags: 1,156
  • sloc: ansic: 9,049; sh: 3,319; makefile: 113
file content (91 lines) | stat: -rw-r--r-- 2,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * medussa - a distributed cracking system
 * Copyright (C) 1999 Kostas Evangelinos <kos@bastard.net>
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 */
/*
 * $Id: dictionary.h,v 1.2 2003/02/05 04:38:37 kos Exp $
 *
 * killdupes saves some speed when killing dupes is costlier than
 * doing another hash generate/compare (look at sha1 8)
 */

#ifndef _DICTIONARY_H
#define _DICTIONARY_H

#include <stdio.h>
#include "array.h"
#include "keyspace.h"
#include "generator.h"

#define DICT_MINLEN 1
#define DICT_MAXLEN 8
#define DICT_WORDSFILE "/usr/dict/words"
#define DICT_RULESFILE "rules"
#define DICT_KILLDUPES 1
#define DICT_FILESERVER "localhost"
#define DICT_FILEPORT "5444"
#define DICT_TEMPDIR "/tmp"

#define DICT_F_RULES 1
#define DICT_F_WORDS 2

#define DICT_LINELEN 1024
#define WORD_LINELEN 256

#ifndef PATH_SEPARATOR
#ifdef unix
#define PATH_SEPARATOR '/'
#else
#define PATH_SEPARATOR '\\'
#endif
#endif

typedef struct dictionary_t {
  key_index_t index;
  key_index_t minindex;
  key_index_t maxindex;
  /* */
  int minlen;
  int maxlen;
  char wordsfile[DICT_LINELEN];
  char rulesfile[DICT_LINELEN];
  char fileserver[DICT_LINELEN];
  char fileport[DICT_LINELEN];
  char tempdir[DICT_LINELEN];
  /* */
  array *rules;
  array *words;
  int rule_index;
  int word_index;
  int killdupes;
  char prevword[DICT_LINELEN];
} dictionary_t;

dictionary_t *dictionary_init(char *opts);
int dictionary_set(dictionary_t *, key_index_t index);
int dictionary_fetch(dictionary_t *, kchar *buf, int len, int *rlen);
int dictionary_done(dictionary_t *);
int dictionary_destroy(dictionary_t *);
key_index_t *dictionary_minindex(dictionary_t *);
key_index_t *dictionary_maxindex(dictionary_t *);
key_index_t *dictionary_curindex(dictionary_t *);
int dictionary_minlen(dictionary_t *);
int dictionary_maxlen(dictionary_t *);

#endif /* _DICTIONARY_H */