Forgot to remove this files in the last commit
This commit is contained in:
parent
520b1aa09f
commit
424e11d851
5 changed files with 0 additions and 2074 deletions
|
@ -1,782 +0,0 @@
|
|||
/*
|
||||
* This program is copyright Alec Muffett 1993. The author disclaims all
|
||||
* responsibility or liability with respect to it's usage or its effect
|
||||
* upon hardware or computer systems, and maintains copyright as set out
|
||||
* in the "LICENCE" document which accompanies distributions of Crack v4.0
|
||||
* and upwards.
|
||||
*/
|
||||
|
||||
/* Diego Gonzalez <diego@pemas.net>
|
||||
* 13-06-2005: Modify funcions to use gettext
|
||||
*/
|
||||
|
||||
static char vers_id[] = "fascist.c : v2.3p3 Alec Muffett 14 dec 1997";
|
||||
|
||||
#include "packer.h"
|
||||
#include <glib/gi18n.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#define ISSKIP(x) (isspace(x) || ispunct(x))
|
||||
|
||||
#define MINDIFF 5
|
||||
#define MINLEN 6
|
||||
#define MAXSTEP 4
|
||||
|
||||
#undef DEBUG
|
||||
#undef DEBUG2
|
||||
|
||||
extern char *Reverse();
|
||||
extern char *Lowercase();
|
||||
|
||||
static char *r_destructors[] = {
|
||||
":", /* noop - must do this to test raw word. */
|
||||
|
||||
#ifdef DEBUG2
|
||||
(char *) 0,
|
||||
#endif
|
||||
|
||||
"[", /* trimming leading/trailing junk */
|
||||
"]",
|
||||
"[[",
|
||||
"]]",
|
||||
"[[[",
|
||||
"]]]",
|
||||
|
||||
"/?p@?p", /* purging out punctuation/symbols/junk */
|
||||
"/?s@?s",
|
||||
"/?X@?X",
|
||||
|
||||
/* attempt reverse engineering of password strings */
|
||||
|
||||
"/$s$s",
|
||||
"/$s$s/0s0o",
|
||||
"/$s$s/0s0o/2s2a",
|
||||
"/$s$s/0s0o/2s2a/3s3e",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1i/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/1s1l/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/5s5s/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1i",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1l",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1i/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1i/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1l/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/1s1l/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/4s4h",
|
||||
"/$s$s/0s0o/2s2a/3s3e/4s4a",
|
||||
"/$s$s/0s0o/2s2a/3s3e/4s4h",
|
||||
"/$s$s/0s0o/2s2a/5s5s",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1i",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1l",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1i/4s4a",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1i/4s4h",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1l/4s4a",
|
||||
"/$s$s/0s0o/2s2a/5s5s/1s1l/4s4h",
|
||||
"/$s$s/0s0o/2s2a/5s5s/4s4a",
|
||||
"/$s$s/0s0o/2s2a/5s5s/4s4h",
|
||||
"/$s$s/0s0o/2s2a/5s5s/4s4a",
|
||||
"/$s$s/0s0o/2s2a/5s5s/4s4h",
|
||||
"/$s$s/0s0o/2s2a/1s1i",
|
||||
"/$s$s/0s0o/2s2a/1s1l",
|
||||
"/$s$s/0s0o/2s2a/1s1i/4s4a",
|
||||
"/$s$s/0s0o/2s2a/1s1i/4s4h",
|
||||
"/$s$s/0s0o/2s2a/1s1l/4s4a",
|
||||
"/$s$s/0s0o/2s2a/1s1l/4s4h",
|
||||
"/$s$s/0s0o/2s2a/4s4a",
|
||||
"/$s$s/0s0o/2s2a/4s4h",
|
||||
"/$s$s/0s0o/2s2a/4s4a",
|
||||
"/$s$s/0s0o/2s2a/4s4h",
|
||||
"/$s$s/0s0o/3s3e",
|
||||
"/$s$s/0s0o/3s3e/5s5s",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1i",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1l",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1i/4s4a",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1i/4s4h",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1l/4s4a",
|
||||
"/$s$s/0s0o/3s3e/5s5s/1s1l/4s4h",
|
||||
"/$s$s/0s0o/3s3e/5s5s/4s4a",
|
||||
"/$s$s/0s0o/3s3e/5s5s/4s4h",
|
||||
"/$s$s/0s0o/3s3e/5s5s/4s4a",
|
||||
"/$s$s/0s0o/3s3e/5s5s/4s4h",
|
||||
"/$s$s/0s0o/3s3e/1s1i",
|
||||
"/$s$s/0s0o/3s3e/1s1l",
|
||||
"/$s$s/0s0o/3s3e/1s1i/4s4a",
|
||||
"/$s$s/0s0o/3s3e/1s1i/4s4h",
|
||||
"/$s$s/0s0o/3s3e/1s1l/4s4a",
|
||||
"/$s$s/0s0o/3s3e/1s1l/4s4h",
|
||||
"/$s$s/0s0o/3s3e/4s4a",
|
||||
"/$s$s/0s0o/3s3e/4s4h",
|
||||
"/$s$s/0s0o/3s3e/4s4a",
|
||||
"/$s$s/0s0o/3s3e/4s4h",
|
||||
"/$s$s/0s0o/5s5s",
|
||||
"/$s$s/0s0o/5s5s/1s1i",
|
||||
"/$s$s/0s0o/5s5s/1s1l",
|
||||
"/$s$s/0s0o/5s5s/1s1i/4s4a",
|
||||
"/$s$s/0s0o/5s5s/1s1i/4s4h",
|
||||
"/$s$s/0s0o/5s5s/1s1l/4s4a",
|
||||
"/$s$s/0s0o/5s5s/1s1l/4s4h",
|
||||
"/$s$s/0s0o/5s5s/4s4a",
|
||||
"/$s$s/0s0o/5s5s/4s4h",
|
||||
"/$s$s/0s0o/5s5s/4s4a",
|
||||
"/$s$s/0s0o/5s5s/4s4h",
|
||||
"/$s$s/0s0o/1s1i",
|
||||
"/$s$s/0s0o/1s1l",
|
||||
"/$s$s/0s0o/1s1i/4s4a",
|
||||
"/$s$s/0s0o/1s1i/4s4h",
|
||||
"/$s$s/0s0o/1s1l/4s4a",
|
||||
"/$s$s/0s0o/1s1l/4s4h",
|
||||
"/$s$s/0s0o/4s4a",
|
||||
"/$s$s/0s0o/4s4h",
|
||||
"/$s$s/0s0o/4s4a",
|
||||
"/$s$s/0s0o/4s4h",
|
||||
"/$s$s/2s2a",
|
||||
"/$s$s/2s2a/3s3e",
|
||||
"/$s$s/2s2a/3s3e/5s5s",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1i",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1l",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1i/4s4a",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1i/4s4h",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1l/4s4a",
|
||||
"/$s$s/2s2a/3s3e/5s5s/1s1l/4s4h",
|
||||
"/$s$s/2s2a/3s3e/5s5s/4s4a",
|
||||
"/$s$s/2s2a/3s3e/5s5s/4s4h",
|
||||
"/$s$s/2s2a/3s3e/5s5s/4s4a",
|
||||
"/$s$s/2s2a/3s3e/5s5s/4s4h",
|
||||
"/$s$s/2s2a/3s3e/1s1i",
|
||||
"/$s$s/2s2a/3s3e/1s1l",
|
||||
"/$s$s/2s2a/3s3e/1s1i/4s4a",
|
||||
"/$s$s/2s2a/3s3e/1s1i/4s4h",
|
||||
"/$s$s/2s2a/3s3e/1s1l/4s4a",
|
||||
"/$s$s/2s2a/3s3e/1s1l/4s4h",
|
||||
"/$s$s/2s2a/3s3e/4s4a",
|
||||
"/$s$s/2s2a/3s3e/4s4h",
|
||||
"/$s$s/2s2a/3s3e/4s4a",
|
||||
"/$s$s/2s2a/3s3e/4s4h",
|
||||
"/$s$s/2s2a/5s5s",
|
||||
"/$s$s/2s2a/5s5s/1s1i",
|
||||
"/$s$s/2s2a/5s5s/1s1l",
|
||||
"/$s$s/2s2a/5s5s/1s1i/4s4a",
|
||||
"/$s$s/2s2a/5s5s/1s1i/4s4h",
|
||||
"/$s$s/2s2a/5s5s/1s1l/4s4a",
|
||||
"/$s$s/2s2a/5s5s/1s1l/4s4h",
|
||||
"/$s$s/2s2a/5s5s/4s4a",
|
||||
"/$s$s/2s2a/5s5s/4s4h",
|
||||
"/$s$s/2s2a/5s5s/4s4a",
|
||||
"/$s$s/2s2a/5s5s/4s4h",
|
||||
"/$s$s/2s2a/1s1i",
|
||||
"/$s$s/2s2a/1s1l",
|
||||
"/$s$s/2s2a/1s1i/4s4a",
|
||||
"/$s$s/2s2a/1s1i/4s4h",
|
||||
"/$s$s/2s2a/1s1l/4s4a",
|
||||
"/$s$s/2s2a/1s1l/4s4h",
|
||||
"/$s$s/2s2a/4s4a",
|
||||
"/$s$s/2s2a/4s4h",
|
||||
"/$s$s/2s2a/4s4a",
|
||||
"/$s$s/2s2a/4s4h",
|
||||
"/$s$s/3s3e",
|
||||
"/$s$s/3s3e/5s5s",
|
||||
"/$s$s/3s3e/5s5s/1s1i",
|
||||
"/$s$s/3s3e/5s5s/1s1l",
|
||||
"/$s$s/3s3e/5s5s/1s1i/4s4a",
|
||||
"/$s$s/3s3e/5s5s/1s1i/4s4h",
|
||||
"/$s$s/3s3e/5s5s/1s1l/4s4a",
|
||||
"/$s$s/3s3e/5s5s/1s1l/4s4h",
|
||||
"/$s$s/3s3e/5s5s/4s4a",
|
||||
"/$s$s/3s3e/5s5s/4s4h",
|
||||
"/$s$s/3s3e/5s5s/4s4a",
|
||||
"/$s$s/3s3e/5s5s/4s4h",
|
||||
"/$s$s/3s3e/1s1i",
|
||||
"/$s$s/3s3e/1s1l",
|
||||
"/$s$s/3s3e/1s1i/4s4a",
|
||||
"/$s$s/3s3e/1s1i/4s4h",
|
||||
"/$s$s/3s3e/1s1l/4s4a",
|
||||
"/$s$s/3s3e/1s1l/4s4h",
|
||||
"/$s$s/3s3e/4s4a",
|
||||
"/$s$s/3s3e/4s4h",
|
||||
"/$s$s/3s3e/4s4a",
|
||||
"/$s$s/3s3e/4s4h",
|
||||
"/$s$s/5s5s",
|
||||
"/$s$s/5s5s/1s1i",
|
||||
"/$s$s/5s5s/1s1l",
|
||||
"/$s$s/5s5s/1s1i/4s4a",
|
||||
"/$s$s/5s5s/1s1i/4s4h",
|
||||
"/$s$s/5s5s/1s1l/4s4a",
|
||||
"/$s$s/5s5s/1s1l/4s4h",
|
||||
"/$s$s/5s5s/4s4a",
|
||||
"/$s$s/5s5s/4s4h",
|
||||
"/$s$s/5s5s/4s4a",
|
||||
"/$s$s/5s5s/4s4h",
|
||||
"/$s$s/1s1i",
|
||||
"/$s$s/1s1l",
|
||||
"/$s$s/1s1i/4s4a",
|
||||
"/$s$s/1s1i/4s4h",
|
||||
"/$s$s/1s1l/4s4a",
|
||||
"/$s$s/1s1l/4s4h",
|
||||
"/$s$s/4s4a",
|
||||
"/$s$s/4s4h",
|
||||
"/$s$s/4s4a",
|
||||
"/$s$s/4s4h",
|
||||
"/0s0o",
|
||||
"/0s0o/2s2a",
|
||||
"/0s0o/2s2a/3s3e",
|
||||
"/0s0o/2s2a/3s3e/5s5s",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1i",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1l",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1i/4s4a",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1i/4s4h",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1l/4s4a",
|
||||
"/0s0o/2s2a/3s3e/5s5s/1s1l/4s4h",
|
||||
"/0s0o/2s2a/3s3e/5s5s/4s4a",
|
||||
"/0s0o/2s2a/3s3e/5s5s/4s4h",
|
||||
"/0s0o/2s2a/3s3e/5s5s/4s4a",
|
||||
"/0s0o/2s2a/3s3e/5s5s/4s4h",
|
||||
"/0s0o/2s2a/3s3e/1s1i",
|
||||
"/0s0o/2s2a/3s3e/1s1l",
|
||||
"/0s0o/2s2a/3s3e/1s1i/4s4a",
|
||||
"/0s0o/2s2a/3s3e/1s1i/4s4h",
|
||||
"/0s0o/2s2a/3s3e/1s1l/4s4a",
|
||||
"/0s0o/2s2a/3s3e/1s1l/4s4h",
|
||||
"/0s0o/2s2a/3s3e/4s4a",
|
||||
"/0s0o/2s2a/3s3e/4s4h",
|
||||
"/0s0o/2s2a/3s3e/4s4a",
|
||||
"/0s0o/2s2a/3s3e/4s4h",
|
||||
"/0s0o/2s2a/5s5s",
|
||||
"/0s0o/2s2a/5s5s/1s1i",
|
||||
"/0s0o/2s2a/5s5s/1s1l",
|
||||
"/0s0o/2s2a/5s5s/1s1i/4s4a",
|
||||
"/0s0o/2s2a/5s5s/1s1i/4s4h",
|
||||
"/0s0o/2s2a/5s5s/1s1l/4s4a",
|
||||
"/0s0o/2s2a/5s5s/1s1l/4s4h",
|
||||
"/0s0o/2s2a/5s5s/4s4a",
|
||||
"/0s0o/2s2a/5s5s/4s4h",
|
||||
"/0s0o/2s2a/5s5s/4s4a",
|
||||
"/0s0o/2s2a/5s5s/4s4h",
|
||||
"/0s0o/2s2a/1s1i",
|
||||
"/0s0o/2s2a/1s1l",
|
||||
"/0s0o/2s2a/1s1i/4s4a",
|
||||
"/0s0o/2s2a/1s1i/4s4h",
|
||||
"/0s0o/2s2a/1s1l/4s4a",
|
||||
"/0s0o/2s2a/1s1l/4s4h",
|
||||
"/0s0o/2s2a/4s4a",
|
||||
"/0s0o/2s2a/4s4h",
|
||||
"/0s0o/2s2a/4s4a",
|
||||
"/0s0o/2s2a/4s4h",
|
||||
"/0s0o/3s3e",
|
||||
"/0s0o/3s3e/5s5s",
|
||||
"/0s0o/3s3e/5s5s/1s1i",
|
||||
"/0s0o/3s3e/5s5s/1s1l",
|
||||
"/0s0o/3s3e/5s5s/1s1i/4s4a",
|
||||
"/0s0o/3s3e/5s5s/1s1i/4s4h",
|
||||
"/0s0o/3s3e/5s5s/1s1l/4s4a",
|
||||
"/0s0o/3s3e/5s5s/1s1l/4s4h",
|
||||
"/0s0o/3s3e/5s5s/4s4a",
|
||||
"/0s0o/3s3e/5s5s/4s4h",
|
||||
"/0s0o/3s3e/5s5s/4s4a",
|
||||
"/0s0o/3s3e/5s5s/4s4h",
|
||||
"/0s0o/3s3e/1s1i",
|
||||
"/0s0o/3s3e/1s1l",
|
||||
"/0s0o/3s3e/1s1i/4s4a",
|
||||
"/0s0o/3s3e/1s1i/4s4h",
|
||||
"/0s0o/3s3e/1s1l/4s4a",
|
||||
"/0s0o/3s3e/1s1l/4s4h",
|
||||
"/0s0o/3s3e/4s4a",
|
||||
"/0s0o/3s3e/4s4h",
|
||||
"/0s0o/3s3e/4s4a",
|
||||
"/0s0o/3s3e/4s4h",
|
||||
"/0s0o/5s5s",
|
||||
"/0s0o/5s5s/1s1i",
|
||||
"/0s0o/5s5s/1s1l",
|
||||
"/0s0o/5s5s/1s1i/4s4a",
|
||||
"/0s0o/5s5s/1s1i/4s4h",
|
||||
"/0s0o/5s5s/1s1l/4s4a",
|
||||
"/0s0o/5s5s/1s1l/4s4h",
|
||||
"/0s0o/5s5s/4s4a",
|
||||
"/0s0o/5s5s/4s4h",
|
||||
"/0s0o/5s5s/4s4a",
|
||||
"/0s0o/5s5s/4s4h",
|
||||
"/0s0o/1s1i",
|
||||
"/0s0o/1s1l",
|
||||
"/0s0o/1s1i/4s4a",
|
||||
"/0s0o/1s1i/4s4h",
|
||||
"/0s0o/1s1l/4s4a",
|
||||
"/0s0o/1s1l/4s4h",
|
||||
"/0s0o/4s4a",
|
||||
"/0s0o/4s4h",
|
||||
"/0s0o/4s4a",
|
||||
"/0s0o/4s4h",
|
||||
"/2s2a",
|
||||
"/2s2a/3s3e",
|
||||
"/2s2a/3s3e/5s5s",
|
||||
"/2s2a/3s3e/5s5s/1s1i",
|
||||
"/2s2a/3s3e/5s5s/1s1l",
|
||||
"/2s2a/3s3e/5s5s/1s1i/4s4a",
|
||||
"/2s2a/3s3e/5s5s/1s1i/4s4h",
|
||||
"/2s2a/3s3e/5s5s/1s1l/4s4a",
|
||||
"/2s2a/3s3e/5s5s/1s1l/4s4h",
|
||||
"/2s2a/3s3e/5s5s/4s4a",
|
||||
"/2s2a/3s3e/5s5s/4s4h",
|
||||
"/2s2a/3s3e/5s5s/4s4a",
|
||||
"/2s2a/3s3e/5s5s/4s4h",
|
||||
"/2s2a/3s3e/1s1i",
|
||||
"/2s2a/3s3e/1s1l",
|
||||
"/2s2a/3s3e/1s1i/4s4a",
|
||||
"/2s2a/3s3e/1s1i/4s4h",
|
||||
"/2s2a/3s3e/1s1l/4s4a",
|
||||
"/2s2a/3s3e/1s1l/4s4h",
|
||||
"/2s2a/3s3e/4s4a",
|
||||
"/2s2a/3s3e/4s4h",
|
||||
"/2s2a/3s3e/4s4a",
|
||||
"/2s2a/3s3e/4s4h",
|
||||
"/2s2a/5s5s",
|
||||
"/2s2a/5s5s/1s1i",
|
||||
"/2s2a/5s5s/1s1l",
|
||||
"/2s2a/5s5s/1s1i/4s4a",
|
||||
"/2s2a/5s5s/1s1i/4s4h",
|
||||
"/2s2a/5s5s/1s1l/4s4a",
|
||||
"/2s2a/5s5s/1s1l/4s4h",
|
||||
"/2s2a/5s5s/4s4a",
|
||||
"/2s2a/5s5s/4s4h",
|
||||
"/2s2a/5s5s/4s4a",
|
||||
"/2s2a/5s5s/4s4h",
|
||||
"/2s2a/1s1i",
|
||||
"/2s2a/1s1l",
|
||||
"/2s2a/1s1i/4s4a",
|
||||
"/2s2a/1s1i/4s4h",
|
||||
"/2s2a/1s1l/4s4a",
|
||||
"/2s2a/1s1l/4s4h",
|
||||
"/2s2a/4s4a",
|
||||
"/2s2a/4s4h",
|
||||
"/2s2a/4s4a",
|
||||
"/2s2a/4s4h",
|
||||
"/3s3e",
|
||||
"/3s3e/5s5s",
|
||||
"/3s3e/5s5s/1s1i",
|
||||
"/3s3e/5s5s/1s1l",
|
||||
"/3s3e/5s5s/1s1i/4s4a",
|
||||
"/3s3e/5s5s/1s1i/4s4h",
|
||||
"/3s3e/5s5s/1s1l/4s4a",
|
||||
"/3s3e/5s5s/1s1l/4s4h",
|
||||
"/3s3e/5s5s/4s4a",
|
||||
"/3s3e/5s5s/4s4h",
|
||||
"/3s3e/5s5s/4s4a",
|
||||
"/3s3e/5s5s/4s4h",
|
||||
"/3s3e/1s1i",
|
||||
"/3s3e/1s1l",
|
||||
"/3s3e/1s1i/4s4a",
|
||||
"/3s3e/1s1i/4s4h",
|
||||
"/3s3e/1s1l/4s4a",
|
||||
"/3s3e/1s1l/4s4h",
|
||||
"/3s3e/4s4a",
|
||||
"/3s3e/4s4h",
|
||||
"/3s3e/4s4a",
|
||||
"/3s3e/4s4h",
|
||||
"/5s5s",
|
||||
"/5s5s/1s1i",
|
||||
"/5s5s/1s1l",
|
||||
"/5s5s/1s1i/4s4a",
|
||||
"/5s5s/1s1i/4s4h",
|
||||
"/5s5s/1s1l/4s4a",
|
||||
"/5s5s/1s1l/4s4h",
|
||||
"/5s5s/4s4a",
|
||||
"/5s5s/4s4h",
|
||||
"/5s5s/4s4a",
|
||||
"/5s5s/4s4h",
|
||||
"/1s1i",
|
||||
"/1s1l",
|
||||
"/1s1i/4s4a",
|
||||
"/1s1i/4s4h",
|
||||
"/1s1l/4s4a",
|
||||
"/1s1l/4s4h",
|
||||
"/4s4a",
|
||||
"/4s4h",
|
||||
"/4s4a",
|
||||
"/4s4h",
|
||||
|
||||
/* done */
|
||||
(char *) 0
|
||||
};
|
||||
|
||||
static char *r_constructors[] = {
|
||||
":",
|
||||
|
||||
#ifdef DEBUG2
|
||||
(char *) 0,
|
||||
#endif
|
||||
|
||||
"r",
|
||||
"d",
|
||||
"f",
|
||||
"dr",
|
||||
"fr",
|
||||
"rf",
|
||||
(char *) 0
|
||||
};
|
||||
|
||||
int
|
||||
GTry(char *rawtext, char *password)
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
char *mp;
|
||||
|
||||
/* use destructors to turn password into rawtext */
|
||||
/* note use of Reverse() to save duplicating all rules */
|
||||
|
||||
len = strlen(password);
|
||||
|
||||
for (i = 0; r_destructors[i]; i++)
|
||||
{
|
||||
if (!(mp = Mangle(password, r_destructors[i])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%-16s = %-16s (destruct %s)\n", mp, rawtext, r_destructors[i]);
|
||||
#endif
|
||||
|
||||
if (!strncmp(mp, rawtext, len))
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%-16s = %-16s (destruct %s reversed)\n", Reverse(mp), rawtext, r_destructors[i]);
|
||||
#endif
|
||||
|
||||
if (!strncmp(Reverse(mp), rawtext, len))
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; r_constructors[i]; i++)
|
||||
{
|
||||
if (!(mp = Mangle(rawtext, r_constructors[i])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%-16s = %-16s (construct %s)\n", mp, password, r_constructors[i]);
|
||||
#endif
|
||||
|
||||
if (!strncmp(mp, password, len))
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *
|
||||
FascistGecos(char *password, int uid)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int wc;
|
||||
char *ptr;
|
||||
int gwords;
|
||||
struct passwd *pwp;
|
||||
char gbuffer[STRINGSIZE];
|
||||
char tbuffer[STRINGSIZE];
|
||||
char *uwords[STRINGSIZE];
|
||||
char longbuffer[STRINGSIZE * 2];
|
||||
|
||||
if (!(pwp = getpwuid(uid)))
|
||||
{
|
||||
return (g_strdup (_("You are not registered in the password file")));
|
||||
}
|
||||
|
||||
/* lets get really paranoid and assume a dangerously long gecos entry */
|
||||
|
||||
strncpy(tbuffer, pwp->pw_name, STRINGSIZE);
|
||||
tbuffer[STRINGSIZE-1] = '\0';
|
||||
if (GTry(tbuffer, password))
|
||||
{
|
||||
return (g_strdup (_("Password based on your username")));
|
||||
}
|
||||
|
||||
/* it never used to be that you got passwd strings > 1024 chars, but now... */
|
||||
|
||||
strncpy(tbuffer, pwp->pw_gecos, STRINGSIZE);
|
||||
tbuffer[STRINGSIZE-1] = '\0';
|
||||
strcpy(gbuffer, Lowercase(tbuffer));
|
||||
|
||||
wc = 0;
|
||||
ptr = gbuffer;
|
||||
gwords = 0;
|
||||
uwords[0] = (char *)0;
|
||||
|
||||
while (*ptr)
|
||||
{
|
||||
while (*ptr && ISSKIP(*ptr))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (ptr != gbuffer)
|
||||
{
|
||||
ptr[-1] = '\0';
|
||||
}
|
||||
|
||||
gwords++;
|
||||
uwords[wc++] = ptr;
|
||||
|
||||
if (wc == STRINGSIZE)
|
||||
{
|
||||
uwords[--wc] = (char *) 0; /* to hell with it */
|
||||
break;
|
||||
} else
|
||||
{
|
||||
uwords[wc] = (char *) 0;
|
||||
}
|
||||
|
||||
while (*ptr && !ISSKIP(*ptr))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr)
|
||||
{
|
||||
*(ptr++) = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; uwords[i]; i++)
|
||||
{
|
||||
printf ("gecosword %s\n", uwords[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; uwords[i]; i++)
|
||||
{
|
||||
if (GTry(uwords[i], password))
|
||||
{
|
||||
return (g_strdup (_("Password based upon your password entry")));
|
||||
}
|
||||
}
|
||||
|
||||
/* since uwords are taken from gbuffer, no uword can be longer than gbuffer */
|
||||
|
||||
for (j = 1; (j < gwords) && uwords[j]; j++)
|
||||
{
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
strcpy(longbuffer, uwords[i]);
|
||||
strcat(longbuffer, uwords[j]);
|
||||
|
||||
if (GTry(longbuffer, password))
|
||||
{
|
||||
return (g_strdup (_("Password derived from your password entry")));
|
||||
}
|
||||
|
||||
strcpy(longbuffer, uwords[j]);
|
||||
strcat(longbuffer, uwords[i]);
|
||||
|
||||
if (GTry(longbuffer, password))
|
||||
{
|
||||
return (g_strdup (_("Password derived from your password entry")));
|
||||
}
|
||||
|
||||
longbuffer[0] = uwords[i][0];
|
||||
longbuffer[1] = '\0';
|
||||
strcat(longbuffer, uwords[j]);
|
||||
|
||||
if (GTry(longbuffer, password))
|
||||
{
|
||||
return (g_strdup (_("Password derivable from your password entry")));
|
||||
}
|
||||
|
||||
longbuffer[0] = uwords[j][0];
|
||||
longbuffer[1] = '\0';
|
||||
strcat(longbuffer, uwords[i]);
|
||||
|
||||
if (GTry(longbuffer, password))
|
||||
{
|
||||
return (g_strdup (_("Password derivable from your password entry")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
char *
|
||||
FascistLook(PWDICT *pwp, char *instring)
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
char *jptr;
|
||||
char junk[STRINGSIZE];
|
||||
char *password;
|
||||
char rpassword[STRINGSIZE];
|
||||
int32 notfound;
|
||||
|
||||
notfound = PW_WORDS(pwp);
|
||||
/* already truncated if from FascistCheck() */
|
||||
/* but pretend it wasn't ... */
|
||||
strncpy(rpassword, instring, TRUNCSTRINGSIZE);
|
||||
rpassword[TRUNCSTRINGSIZE - 1] = '\0';
|
||||
password = rpassword;
|
||||
|
||||
if (strlen(password) < 4)
|
||||
{
|
||||
return (g_strdup (_("Password is way too short")));
|
||||
}
|
||||
|
||||
if (strlen(password) < MINLEN)
|
||||
{
|
||||
return (g_strdup (_("Password is too short")));
|
||||
}
|
||||
|
||||
jptr = junk;
|
||||
*jptr = '\0';
|
||||
|
||||
for (i = 0; i < STRINGSIZE && password[i]; i++)
|
||||
{
|
||||
if (!strchr(junk, password[i]))
|
||||
{
|
||||
*(jptr++) = password[i];
|
||||
*jptr = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(junk) < MINDIFF)
|
||||
{
|
||||
return (g_strdup (_("Password does not contain enough different characters")));
|
||||
}
|
||||
|
||||
strcpy(password, Lowercase(password));
|
||||
|
||||
Trim(password);
|
||||
|
||||
while (*password && isspace(*password))
|
||||
{
|
||||
password++;
|
||||
}
|
||||
|
||||
if (!*password)
|
||||
{
|
||||
return (g_strdup (_("Password is all whitespace")));
|
||||
}
|
||||
|
||||
i = 0;
|
||||
ptr = password;
|
||||
while (ptr[0] && ptr[1])
|
||||
{
|
||||
if ((ptr[1] == (ptr[0] + 1)) || (ptr[1] == (ptr[0] - 1)))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (i > MAXSTEP)
|
||||
{
|
||||
return (g_strdup (_("Password is too simplistic/systematic")));
|
||||
}
|
||||
|
||||
if (PMatch("aadddddda", password)) /* smirk */
|
||||
{
|
||||
return (g_strdup (_("Password looks like a National Insurance number.")));
|
||||
}
|
||||
|
||||
if (ptr = FascistGecos(password, getuid()))
|
||||
{
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
/* it should be safe to use Mangle with its reliance on STRINGSIZE
|
||||
since password cannot be longer than TRUNCSTRINGSIZE;
|
||||
nonetheless this is not an elegant solution */
|
||||
|
||||
for (i = 0; r_destructors[i]; i++)
|
||||
{
|
||||
char *a;
|
||||
|
||||
if (!(a = Mangle(password, r_destructors[i])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%-16s (dict)\n", a);
|
||||
#endif
|
||||
|
||||
if (FindPW(pwp, a) != notfound)
|
||||
{
|
||||
return (g_strdup (_("Password based on a dictionary word")));
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(password, Reverse(password));
|
||||
|
||||
for (i = 0; r_destructors[i]; i++)
|
||||
{
|
||||
char *a;
|
||||
|
||||
if (!(a = Mangle(password, r_destructors[i])))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("%-16s (reversed dict)\n", a);
|
||||
#endif
|
||||
if (FindPW(pwp, a) != notfound)
|
||||
{
|
||||
return (g_strdup (_("it is based on a (reversed) dictionary word")));
|
||||
}
|
||||
}
|
||||
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
char *
|
||||
FascistCheck (char *password, char *path)
|
||||
{
|
||||
static char lastpath[STRINGSIZE];
|
||||
static PWDICT *pwp;
|
||||
char pwtrunced[STRINGSIZE];
|
||||
|
||||
/* security problem: assume we may have been given a really long
|
||||
password (buffer attack) and so truncate it to a workable size;
|
||||
try to define workable size as something from which we cannot
|
||||
extend a buffer beyond its limits in the rest of the code */
|
||||
|
||||
strncpy(pwtrunced, password, TRUNCSTRINGSIZE);
|
||||
pwtrunced[TRUNCSTRINGSIZE - 1] = '\0'; /* enforce */
|
||||
|
||||
/* perhaps someone should put something here to check if password
|
||||
is really long and syslog() a message denoting buffer attacks? */
|
||||
|
||||
if (pwp && strncmp(lastpath, path, STRINGSIZE))
|
||||
{
|
||||
PWClose(pwp);
|
||||
pwp = (PWDICT *)0;
|
||||
}
|
||||
|
||||
if (!pwp)
|
||||
{
|
||||
if (!(pwp = PWOpen(path, "r")))
|
||||
{
|
||||
perror("PWOpen");
|
||||
exit(-1);
|
||||
}
|
||||
strncpy(lastpath, path, STRINGSIZE);
|
||||
}
|
||||
|
||||
return (FascistLook(pwp, pwtrunced));
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* This program is copyright Alec Muffett 1993. The author disclaims all
|
||||
* responsibility or liability with respect to it's usage or its effect
|
||||
* upon hardware or computer systems, and maintains copyright as set out
|
||||
* in the "LICENCE" document which accompanies distributions of Crack v4.0
|
||||
* and upwards.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define STRINGSIZE 1024
|
||||
#define TRUNCSTRINGSIZE (STRINGSIZE/4)
|
||||
|
||||
typedef unsigned char int8;
|
||||
typedef unsigned short int int16;
|
||||
typedef unsigned long int int32;
|
||||
#ifndef NUMWORDS
|
||||
#define NUMWORDS 16
|
||||
#endif
|
||||
#define MAXWORDLEN 32
|
||||
#define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS)
|
||||
|
||||
struct pi_header
|
||||
{
|
||||
int32 pih_magic;
|
||||
int32 pih_numwords;
|
||||
int16 pih_blocklen;
|
||||
int16 pih_pad;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FILE *ifp;
|
||||
FILE *dfp;
|
||||
FILE *wfp;
|
||||
|
||||
int32 flags;
|
||||
#define PFOR_WRITE 0x0001
|
||||
#define PFOR_FLUSH 0x0002
|
||||
#define PFOR_USEHWMS 0x0004
|
||||
|
||||
int32 hwms[256];
|
||||
|
||||
struct pi_header header;
|
||||
|
||||
int count;
|
||||
char data[NUMWORDS][MAXWORDLEN];
|
||||
} PWDICT;
|
||||
|
||||
#define PW_WORDS(x) ((x)->header.pih_numwords)
|
||||
#define PIH_MAGIC 0x70775631
|
||||
|
||||
extern PWDICT *PWOpen();
|
||||
extern char *Mangle();
|
||||
extern char *FascistCheck();
|
||||
|
||||
#define CRACK_TOLOWER(a) (isupper(a)?tolower(a):(a))
|
||||
#define CRACK_TOUPPER(a) (islower(a)?toupper(a):(a))
|
||||
#define STRCMP(a,b) strcmp((a),(b))
|
|
@ -1,356 +0,0 @@
|
|||
/*
|
||||
* This program is copyright Alec Muffett 1993. The author disclaims all
|
||||
* responsibility or liability with respect to it's usage or its effect
|
||||
* upon hardware or computer systems, and maintains copyright as set out
|
||||
* in the "LICENCE" document which accompanies distributions of Crack v4.0
|
||||
* and upwards.
|
||||
*/
|
||||
|
||||
#include "packer.h"
|
||||
|
||||
static char vers_id[] = "packlib.c : v2.3p2 Alec Muffett 18 May 1993";
|
||||
|
||||
PWDICT *
|
||||
PWOpen(prefix, mode)
|
||||
char *prefix;
|
||||
char *mode;
|
||||
{
|
||||
int32 i;
|
||||
static PWDICT pdesc;
|
||||
char iname[STRINGSIZE];
|
||||
char dname[STRINGSIZE];
|
||||
char wname[STRINGSIZE];
|
||||
char buffer[STRINGSIZE];
|
||||
FILE *dfp;
|
||||
FILE *ifp;
|
||||
FILE *wfp;
|
||||
|
||||
if (pdesc.header.pih_magic == PIH_MAGIC)
|
||||
{
|
||||
fprintf(stderr, "%s: another dictionary already open\n", prefix);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
memset(&pdesc, '\0', sizeof(pdesc));
|
||||
|
||||
sprintf(iname, "%s.pwi", prefix);
|
||||
sprintf(dname, "%s.pwd", prefix);
|
||||
sprintf(wname, "%s.hwm", prefix);
|
||||
|
||||
if (!(pdesc.dfp = fopen(dname, mode)))
|
||||
{
|
||||
perror(dname);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
if (!(pdesc.ifp = fopen(iname, mode)))
|
||||
{
|
||||
fclose(pdesc.dfp);
|
||||
perror(iname);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
if (pdesc.wfp = fopen(wname, mode))
|
||||
{
|
||||
pdesc.flags |= PFOR_USEHWMS;
|
||||
}
|
||||
|
||||
ifp = pdesc.ifp;
|
||||
dfp = pdesc.dfp;
|
||||
wfp = pdesc.wfp;
|
||||
|
||||
if (mode[0] == 'w')
|
||||
{
|
||||
pdesc.flags |= PFOR_WRITE;
|
||||
pdesc.header.pih_magic = PIH_MAGIC;
|
||||
pdesc.header.pih_blocklen = NUMWORDS;
|
||||
pdesc.header.pih_numwords = 0;
|
||||
|
||||
fwrite((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp);
|
||||
} else
|
||||
{
|
||||
pdesc.flags &= ~PFOR_WRITE;
|
||||
|
||||
if (!fread((char *) &pdesc.header, sizeof(pdesc.header), 1, ifp))
|
||||
{
|
||||
fprintf(stderr, "%s: error reading header\n", prefix);
|
||||
|
||||
pdesc.header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
if (pdesc.header.pih_magic != PIH_MAGIC)
|
||||
{
|
||||
fprintf(stderr, "%s: magic mismatch\n", prefix);
|
||||
|
||||
pdesc.header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
if (pdesc.header.pih_blocklen != NUMWORDS)
|
||||
{
|
||||
fprintf(stderr, "%s: size mismatch\n", prefix);
|
||||
|
||||
pdesc.header.pih_magic = 0;
|
||||
fclose(ifp);
|
||||
fclose(dfp);
|
||||
return ((PWDICT *) 0);
|
||||
}
|
||||
|
||||
if (pdesc.flags & PFOR_USEHWMS)
|
||||
{
|
||||
if (fread(pdesc.hwms, 1, sizeof(pdesc.hwms), wfp) != sizeof(pdesc.hwms))
|
||||
{
|
||||
pdesc.flags &= ~PFOR_USEHWMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (&pdesc);
|
||||
}
|
||||
|
||||
int
|
||||
PWClose(pwp)
|
||||
PWDICT *pwp;
|
||||
{
|
||||
if (pwp->header.pih_magic != PIH_MAGIC)
|
||||
{
|
||||
fprintf(stderr, "PWClose: close magic mismatch\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (pwp->flags & PFOR_WRITE)
|
||||
{
|
||||
pwp->flags |= PFOR_FLUSH;
|
||||
PutPW(pwp, (char *) 0); /* flush last index if necess */
|
||||
|
||||
if (fseek(pwp->ifp, 0L, 0))
|
||||
{
|
||||
fprintf(stderr, "index magic fseek failed\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!fwrite((char *) &pwp->header, sizeof(pwp->header), 1, pwp->ifp))
|
||||
{
|
||||
fprintf(stderr, "index magic fwrite failed\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (pwp->flags & PFOR_USEHWMS)
|
||||
{
|
||||
int i;
|
||||
for (i=1; i<=0xff; i++)
|
||||
{
|
||||
if (!pwp->hwms[i])
|
||||
{
|
||||
pwp->hwms[i] = pwp->hwms[i-1];
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("hwm[%02x] = %d\n", i, pwp->hwms[i]);
|
||||
#endif
|
||||
}
|
||||
fwrite(pwp->hwms, 1, sizeof(pwp->hwms), pwp->wfp);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pwp->ifp);
|
||||
fclose(pwp->dfp);
|
||||
|
||||
pwp->header.pih_magic = 0;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
PutPW(pwp, string)
|
||||
PWDICT *pwp;
|
||||
char *string;
|
||||
{
|
||||
if (!(pwp->flags & PFOR_WRITE))
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (string)
|
||||
{
|
||||
strncpy(pwp->data[pwp->count], string, MAXWORDLEN);
|
||||
pwp->data[pwp->count][MAXWORDLEN - 1] = '\0';
|
||||
|
||||
pwp->hwms[string[0] & 0xff]= pwp->header.pih_numwords;
|
||||
|
||||
++(pwp->count);
|
||||
++(pwp->header.pih_numwords);
|
||||
|
||||
} else if (!(pwp->flags & PFOR_FLUSH))
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((pwp->flags & PFOR_FLUSH) || !(pwp->count % NUMWORDS))
|
||||
{
|
||||
int i;
|
||||
int32 datum;
|
||||
register char *ostr;
|
||||
|
||||
datum = (int32) ftell(pwp->dfp);
|
||||
|
||||
fwrite((char *) &datum, sizeof(datum), 1, pwp->ifp);
|
||||
|
||||
fputs(pwp->data[0], pwp->dfp);
|
||||
putc(0, pwp->dfp);
|
||||
|
||||
ostr = pwp->data[0];
|
||||
|
||||
for (i = 1; i < NUMWORDS; i++)
|
||||
{
|
||||
register int j;
|
||||
register char *nstr;
|
||||
nstr = pwp->data[i];
|
||||
|
||||
if (nstr[0])
|
||||
{
|
||||
for (j = 0; ostr[j] && nstr[j] && (ostr[j] == nstr[j]); j++);
|
||||
putc(j & 0xff, pwp->dfp);
|
||||
fputs(nstr + j, pwp->dfp);
|
||||
}
|
||||
putc(0, pwp->dfp);
|
||||
|
||||
ostr = nstr;
|
||||
}
|
||||
|
||||
memset(pwp->data, '\0', sizeof(pwp->data));
|
||||
pwp->count = 0;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
char *
|
||||
GetPW(pwp, number)
|
||||
PWDICT *pwp;
|
||||
int32 number;
|
||||
{
|
||||
int32 datum;
|
||||
register int i;
|
||||
register char *ostr;
|
||||
register char *nstr;
|
||||
register char *bptr;
|
||||
char buffer[NUMWORDS * MAXWORDLEN];
|
||||
static char data[NUMWORDS][MAXWORDLEN];
|
||||
static int32 prevblock = 0xffffffff;
|
||||
int32 thisblock;
|
||||
|
||||
thisblock = number / NUMWORDS;
|
||||
|
||||
if (prevblock == thisblock)
|
||||
{
|
||||
return (data[number % NUMWORDS]);
|
||||
}
|
||||
|
||||
if (fseek(pwp->ifp, sizeof(struct pi_header) + (thisblock * sizeof(int32)), 0))
|
||||
{
|
||||
perror("(index fseek failed)");
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
if (!fread((char *) &datum, sizeof(datum), 1, pwp->ifp))
|
||||
{
|
||||
perror("(index fread failed)");
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
if (fseek(pwp->dfp, datum, 0))
|
||||
{
|
||||
perror("(data fseek failed)");
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
if (!fread(buffer, 1, sizeof(buffer), pwp->dfp))
|
||||
{
|
||||
perror("(data fread failed)");
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
prevblock = thisblock;
|
||||
|
||||
bptr = buffer;
|
||||
|
||||
for (ostr = data[0]; *(ostr++) = *(bptr++); /* nothing */ );
|
||||
|
||||
ostr = data[0];
|
||||
|
||||
for (i = 1; i < NUMWORDS; i++)
|
||||
{
|
||||
nstr = data[i];
|
||||
strcpy(nstr, ostr);
|
||||
|
||||
ostr = nstr + *(bptr++);
|
||||
while (*(ostr++) = *(bptr++));
|
||||
|
||||
ostr = nstr;
|
||||
}
|
||||
|
||||
return (data[number % NUMWORDS]);
|
||||
}
|
||||
|
||||
int32
|
||||
FindPW(pwp, string)
|
||||
PWDICT *pwp;
|
||||
char *string;
|
||||
{
|
||||
register int32 lwm;
|
||||
register int32 hwm;
|
||||
register int32 middle;
|
||||
register char *this;
|
||||
int idx;
|
||||
|
||||
if (pwp->flags & PFOR_USEHWMS)
|
||||
{
|
||||
idx = string[0] & 0xff;
|
||||
lwm = idx ? pwp->hwms[idx - 1] : 0;
|
||||
hwm = pwp->hwms[idx];
|
||||
} else
|
||||
{
|
||||
lwm = 0;
|
||||
hwm = PW_WORDS(pwp) - 1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("---- %lu, %lu ----\n", lwm, hwm);
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int cmp;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%lu, %lu\n", lwm, hwm);
|
||||
#endif
|
||||
|
||||
middle = lwm + ((hwm - lwm + 1) / 2);
|
||||
|
||||
if (middle == hwm)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
this = GetPW(pwp, middle);
|
||||
cmp = strcmp(string, this); /* INLINE ? */
|
||||
|
||||
if (cmp < 0)
|
||||
{
|
||||
hwm = middle;
|
||||
} else if (cmp > 0)
|
||||
{
|
||||
lwm = middle;
|
||||
} else
|
||||
{
|
||||
return (middle);
|
||||
}
|
||||
}
|
||||
|
||||
return (PW_WORDS(pwp));
|
||||
}
|
|
@ -1,824 +0,0 @@
|
|||
/*
|
||||
* This program is copyright Alec Muffett 1993. The author disclaims all
|
||||
* responsibility or liability with respect to it's usage or its effect
|
||||
* upon hardware or computer systems, and maintains copyright as set out
|
||||
* in the "LICENCE" document which accompanies distributions of Crack v4.0
|
||||
* and upwards.
|
||||
*/
|
||||
|
||||
static char vers_id[] = "rules.c : v5.0p3 Alec Muffett 20 May 1993";
|
||||
|
||||
|
||||
#include "packer.h"
|
||||
|
||||
static void
|
||||
Debug(val, a, b, c, d, e, f, g)
|
||||
int val;
|
||||
char *a, *b, *c, *d, *e, *f, *g;
|
||||
{
|
||||
fprintf(stderr, a, b, c, d, e, f);
|
||||
}
|
||||
|
||||
|
||||
#define RULE_NOOP ':'
|
||||
#define RULE_PREPEND '^'
|
||||
#define RULE_APPEND '$'
|
||||
#define RULE_REVERSE 'r'
|
||||
#define RULE_UPPERCASE 'u'
|
||||
#define RULE_LOWERCASE 'l'
|
||||
#define RULE_PLURALISE 'p'
|
||||
#define RULE_CAPITALISE 'c'
|
||||
#define RULE_DUPLICATE 'd'
|
||||
#define RULE_REFLECT 'f'
|
||||
#define RULE_SUBSTITUTE 's'
|
||||
#define RULE_MATCH '/'
|
||||
#define RULE_NOT '!'
|
||||
#define RULE_LT '<'
|
||||
#define RULE_GT '>'
|
||||
#define RULE_EXTRACT 'x'
|
||||
#define RULE_OVERSTRIKE 'o'
|
||||
#define RULE_INSERT 'i'
|
||||
#define RULE_EQUALS '='
|
||||
#define RULE_PURGE '@'
|
||||
#define RULE_CLASS '?' /* class rule? socialist ethic in cracker? */
|
||||
|
||||
#define RULE_DFIRST '['
|
||||
#define RULE_DLAST ']'
|
||||
#define RULE_MFIRST '('
|
||||
#define RULE_MLAST ')'
|
||||
|
||||
int
|
||||
Suffix(myword, suffix)
|
||||
char *myword;
|
||||
char *suffix;
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
i = strlen(myword);
|
||||
j = strlen(suffix);
|
||||
|
||||
if (i > j)
|
||||
{
|
||||
return (STRCMP((myword + i - j), suffix));
|
||||
} else
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
Reverse(str) /* return a pointer to a reversal */
|
||||
register char *str;
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
static char area[STRINGSIZE];
|
||||
j = i = strlen(str);
|
||||
while (*str)
|
||||
{
|
||||
area[--i] = *str++;
|
||||
}
|
||||
area[j] = '\0';
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Uppercase(str) /* return a pointer to an uppercase */
|
||||
register char *str;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*str)
|
||||
{
|
||||
*(ptr++) = CRACK_TOUPPER(*str);
|
||||
str++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Lowercase(str) /* return a pointer to an lowercase */
|
||||
register char *str;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*str)
|
||||
{
|
||||
*(ptr++) = CRACK_TOLOWER(*str);
|
||||
str++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Capitalise(str) /* return a pointer to an capitalised */
|
||||
register char *str;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
*(ptr++) = CRACK_TOLOWER(*str);
|
||||
str++;
|
||||
}
|
||||
|
||||
*ptr = '\0';
|
||||
area[0] = CRACK_TOUPPER(area[0]);
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Pluralise(string) /* returns a pointer to a plural */
|
||||
register char *string;
|
||||
{
|
||||
register int length;
|
||||
static char area[STRINGSIZE];
|
||||
length = strlen(string);
|
||||
strcpy(area, string);
|
||||
|
||||
if (!Suffix(string, "ch") ||
|
||||
!Suffix(string, "ex") ||
|
||||
!Suffix(string, "ix") ||
|
||||
!Suffix(string, "sh") ||
|
||||
!Suffix(string, "ss"))
|
||||
{
|
||||
/* bench -> benches */
|
||||
strcat(area, "es");
|
||||
} else if (length > 2 && string[length - 1] == 'y')
|
||||
{
|
||||
if (strchr("aeiou", string[length - 2]))
|
||||
{
|
||||
/* alloy -> alloys */
|
||||
strcat(area, "s");
|
||||
} else
|
||||
{
|
||||
/* gully -> gullies */
|
||||
strcpy(area + length - 1, "ies");
|
||||
}
|
||||
} else if (string[length - 1] == 's')
|
||||
{
|
||||
/* bias -> biases */
|
||||
strcat(area, "es");
|
||||
} else
|
||||
{
|
||||
/* catchall */
|
||||
strcat(area, "s");
|
||||
}
|
||||
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Substitute(string, old, new) /* returns pointer to a swapped about copy */
|
||||
register char *string;
|
||||
register char old;
|
||||
register char new;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*string)
|
||||
{
|
||||
*(ptr++) = (*string == old ? new : *string);
|
||||
string++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
Purge(string, target) /* returns pointer to a purged copy */
|
||||
register char *string;
|
||||
register char target;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*string)
|
||||
{
|
||||
if (*string != target)
|
||||
{
|
||||
*(ptr++) = *string;
|
||||
}
|
||||
string++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return (area);
|
||||
}
|
||||
/* -------- CHARACTER CLASSES START HERE -------- */
|
||||
|
||||
/*
|
||||
* this function takes two inputs, a class identifier and a character, and
|
||||
* returns non-null if the given character is a member of the class, based
|
||||
* upon restrictions set out below
|
||||
*/
|
||||
|
||||
int
|
||||
MatchClass(class, input)
|
||||
register char class;
|
||||
register char input;
|
||||
{
|
||||
register char c;
|
||||
register int retval;
|
||||
retval = 0;
|
||||
|
||||
switch (class)
|
||||
{
|
||||
/* ESCAPE */
|
||||
|
||||
case '?': /* ?? -> ? */
|
||||
if (input == '?')
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* ILLOGICAL GROUPINGS (ie: not in ctype.h) */
|
||||
|
||||
case 'V':
|
||||
case 'v': /* vowels */
|
||||
c = CRACK_TOLOWER(input);
|
||||
if (strchr("aeiou", c))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
case 'c': /* consonants */
|
||||
c = CRACK_TOLOWER(input);
|
||||
if (strchr("bcdfghjklmnpqrstvwxyz", c))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
case 'w': /* whitespace */
|
||||
if (strchr("\t ", input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
case 'p': /* punctuation */
|
||||
if (strchr(".`,:;'!?\"", input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
case 's': /* symbols */
|
||||
if (strchr("$%%^&*()-_+=|\\[]{}#@/~", input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* LOGICAL GROUPINGS */
|
||||
|
||||
case 'L':
|
||||
case 'l': /* lowercase */
|
||||
if (islower(input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
case 'u': /* uppercase */
|
||||
if (isupper(input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
case 'a': /* alphabetic */
|
||||
if (isalpha(input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
case 'x': /* alphanumeric */
|
||||
if (isalnum(input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'd': /* digits */
|
||||
if (isdigit(input))
|
||||
{
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug(1, "MatchClass: unknown class %c\n", class);
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (isupper(class))
|
||||
{
|
||||
return (!retval);
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
|
||||
char *
|
||||
PolyStrchr(string, class)
|
||||
register char *string;
|
||||
register char class;
|
||||
{
|
||||
while (*string)
|
||||
{
|
||||
if (MatchClass(class, *string))
|
||||
{
|
||||
return (string);
|
||||
}
|
||||
string++;
|
||||
}
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
char *
|
||||
PolySubst(string, class, new) /* returns pointer to a swapped about copy */
|
||||
register char *string;
|
||||
register char class;
|
||||
register char new;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*string)
|
||||
{
|
||||
*(ptr++) = (MatchClass(class, *string) ? new : *string);
|
||||
string++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return (area);
|
||||
}
|
||||
|
||||
char *
|
||||
PolyPurge(string, class) /* returns pointer to a purged copy */
|
||||
register char *string;
|
||||
register char class;
|
||||
{
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
ptr = area;
|
||||
while (*string)
|
||||
{
|
||||
if (!MatchClass(class, *string))
|
||||
{
|
||||
*(ptr++) = *string;
|
||||
}
|
||||
string++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return (area);
|
||||
}
|
||||
/* -------- BACK TO NORMALITY -------- */
|
||||
|
||||
int
|
||||
Char2Int(character)
|
||||
char character;
|
||||
{
|
||||
if (isdigit(character))
|
||||
{
|
||||
return (character - '0');
|
||||
} else if (islower(character))
|
||||
{
|
||||
return (character - 'a' + 10);
|
||||
} else if (isupper(character))
|
||||
{
|
||||
return (character - 'A' + 10);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
char *
|
||||
Mangle(input, control) /* returns a pointer to a controlled Mangle */
|
||||
char *input;
|
||||
char *control;
|
||||
{
|
||||
int limit;
|
||||
register char *ptr;
|
||||
static char area[STRINGSIZE];
|
||||
char area2[STRINGSIZE];
|
||||
area[0] = '\0';
|
||||
strcpy(area, input);
|
||||
|
||||
for (ptr = control; *ptr; ptr++)
|
||||
{
|
||||
switch (*ptr)
|
||||
{
|
||||
case RULE_NOOP:
|
||||
break;
|
||||
case RULE_REVERSE:
|
||||
strcpy(area, Reverse(area));
|
||||
break;
|
||||
case RULE_UPPERCASE:
|
||||
strcpy(area, Uppercase(area));
|
||||
break;
|
||||
case RULE_LOWERCASE:
|
||||
strcpy(area, Lowercase(area));
|
||||
break;
|
||||
case RULE_CAPITALISE:
|
||||
strcpy(area, Capitalise(area));
|
||||
break;
|
||||
case RULE_PLURALISE:
|
||||
strcpy(area, Pluralise(area));
|
||||
break;
|
||||
case RULE_REFLECT:
|
||||
strcat(area, Reverse(area));
|
||||
break;
|
||||
case RULE_DUPLICATE:
|
||||
strcpy(area2, area);
|
||||
strcat(area, area2);
|
||||
break;
|
||||
case RULE_GT:
|
||||
if (!ptr[1])
|
||||
{
|
||||
Debug(1, "Mangle: '>' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
limit = Char2Int(*(++ptr));
|
||||
if (limit < 0)
|
||||
{
|
||||
Debug(1, "Mangle: '>' weird argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
}
|
||||
if (strlen(area) <= limit)
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RULE_LT:
|
||||
if (!ptr[1])
|
||||
{
|
||||
Debug(1, "Mangle: '<' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
limit = Char2Int(*(++ptr));
|
||||
if (limit < 0)
|
||||
{
|
||||
Debug(1, "Mangle: '<' weird argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
}
|
||||
if (strlen(area) >= limit)
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RULE_PREPEND:
|
||||
if (!ptr[1])
|
||||
{
|
||||
Debug(1, "Mangle: prepend missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
area2[0] = *(++ptr);
|
||||
strcpy(area2 + 1, area);
|
||||
strcpy(area, area2);
|
||||
}
|
||||
break;
|
||||
case RULE_APPEND:
|
||||
if (!ptr[1])
|
||||
{
|
||||
Debug(1, "Mangle: append missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register char *string;
|
||||
string = area;
|
||||
while (*(string++));
|
||||
string[-1] = *(++ptr);
|
||||
*string = '\0';
|
||||
}
|
||||
break;
|
||||
case RULE_EXTRACT:
|
||||
if (!ptr[1] || !ptr[2])
|
||||
{
|
||||
Debug(1, "Mangle: extract missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register int i;
|
||||
int start;
|
||||
int length;
|
||||
start = Char2Int(*(++ptr));
|
||||
length = Char2Int(*(++ptr));
|
||||
if (start < 0 || length < 0)
|
||||
{
|
||||
Debug(1, "Mangle: extract: weird argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
}
|
||||
strcpy(area2, area);
|
||||
for (i = 0; length-- && area2[start + i]; i++)
|
||||
{
|
||||
area[i] = area2[start + i];
|
||||
}
|
||||
/* cant use strncpy() - no trailing NUL */
|
||||
area[i] = '\0';
|
||||
}
|
||||
break;
|
||||
case RULE_OVERSTRIKE:
|
||||
if (!ptr[1] || !ptr[2])
|
||||
{
|
||||
Debug(1, "Mangle: overstrike missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register int i;
|
||||
i = Char2Int(*(++ptr));
|
||||
if (i < 0)
|
||||
{
|
||||
Debug(1, "Mangle: overstrike weird argument in '%s'\n",
|
||||
control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
++ptr;
|
||||
if (area[i])
|
||||
{
|
||||
area[i] = *ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RULE_INSERT:
|
||||
if (!ptr[1] || !ptr[2])
|
||||
{
|
||||
Debug(1, "Mangle: insert missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register int i;
|
||||
register char *p1;
|
||||
register char *p2;
|
||||
i = Char2Int(*(++ptr));
|
||||
if (i < 0)
|
||||
{
|
||||
Debug(1, "Mangle: insert weird argument in '%s'\n",
|
||||
control);
|
||||
return ((char *) 0);
|
||||
}
|
||||
p1 = area;
|
||||
p2 = area2;
|
||||
while (i && *p1)
|
||||
{
|
||||
i--;
|
||||
*(p2++) = *(p1++);
|
||||
}
|
||||
*(p2++) = *(++ptr);
|
||||
strcpy(p2, p1);
|
||||
strcpy(area, area2);
|
||||
}
|
||||
break;
|
||||
/* THE FOLLOWING RULES REQUIRE CLASS MATCHING */
|
||||
|
||||
case RULE_PURGE: /* @x or @?c */
|
||||
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
|
||||
{
|
||||
Debug(1, "Mangle: delete missing arguments in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
strcpy(area, Purge(area, *(++ptr)));
|
||||
} else
|
||||
{
|
||||
strcpy(area, PolyPurge(area, ptr[2]));
|
||||
ptr += 2;
|
||||
}
|
||||
break;
|
||||
case RULE_SUBSTITUTE: /* sxy || s?cy */
|
||||
if (!ptr[1] || !ptr[2] || (ptr[1] == RULE_CLASS && !ptr[3]))
|
||||
{
|
||||
Debug(1, "Mangle: subst missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
strcpy(area, Substitute(area, ptr[1], ptr[2]));
|
||||
ptr += 2;
|
||||
} else
|
||||
{
|
||||
strcpy(area, PolySubst(area, ptr[2], ptr[3]));
|
||||
ptr += 3;
|
||||
}
|
||||
break;
|
||||
case RULE_MATCH: /* /x || /?c */
|
||||
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
|
||||
{
|
||||
Debug(1, "Mangle: '/' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
if (!strchr(area, *(++ptr)))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (!PolyStrchr(area, ptr[2]))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
ptr += 2;
|
||||
}
|
||||
break;
|
||||
case RULE_NOT: /* !x || !?c */
|
||||
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
|
||||
{
|
||||
Debug(1, "Mangle: '!' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
if (strchr(area, *(++ptr)))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (PolyStrchr(area, ptr[2]))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
ptr += 2;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
* alternative use for a boomerang, number 1: a standard throwing
|
||||
* boomerang is an ideal thing to use to tuck the sheets under
|
||||
* the mattress when making your bed. The streamlined shape of
|
||||
* the boomerang allows it to slip easily 'twixt mattress and
|
||||
* bedframe, and it's curve makes it very easy to hook sheets
|
||||
* into the gap.
|
||||
*/
|
||||
|
||||
case RULE_EQUALS: /* =nx || =n?c */
|
||||
if (!ptr[1] || !ptr[2] || (ptr[2] == RULE_CLASS && !ptr[3]))
|
||||
{
|
||||
Debug(1, "Mangle: '=' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register int i;
|
||||
if ((i = Char2Int(ptr[1])) < 0)
|
||||
{
|
||||
Debug(1, "Mangle: '=' weird argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
}
|
||||
if (ptr[2] != RULE_CLASS)
|
||||
{
|
||||
ptr += 2;
|
||||
if (area[i] != *ptr)
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
ptr += 3;
|
||||
if (!MatchClass(*ptr, area[i]))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_DFIRST:
|
||||
if (area[0])
|
||||
{
|
||||
register int i;
|
||||
for (i = 1; area[i]; i++)
|
||||
{
|
||||
area[i - 1] = area[i];
|
||||
}
|
||||
area[i - 1] = '\0';
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_DLAST:
|
||||
if (area[0])
|
||||
{
|
||||
register int i;
|
||||
for (i = 1; area[i]; i++);
|
||||
area[i - 1] = '\0';
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_MFIRST:
|
||||
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
|
||||
{
|
||||
Debug(1, "Mangle: '(' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
ptr++;
|
||||
if (area[0] != *ptr)
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
ptr += 2;
|
||||
if (!MatchClass(*ptr, area[0]))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
case RULE_MLAST:
|
||||
if (!ptr[1] || (ptr[1] == RULE_CLASS && !ptr[2]))
|
||||
{
|
||||
Debug(1, "Mangle: ')' missing argument in '%s'\n", control);
|
||||
return ((char *) 0);
|
||||
} else
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; area[i]; i++);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
i--;
|
||||
} else
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
|
||||
if (ptr[1] != RULE_CLASS)
|
||||
{
|
||||
ptr++;
|
||||
if (area[i] != *ptr)
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
ptr += 2;
|
||||
if (!MatchClass(*ptr, area[i]))
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
Debug(1, "Mangle: unknown command %c in %s\n", *ptr, control);
|
||||
return ((char *) 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!area[0]) /* have we deweted de poor widdle fing away? */
|
||||
{
|
||||
return ((char *) 0);
|
||||
}
|
||||
return (area);
|
||||
}
|
||||
|
||||
int
|
||||
PMatch(control, string)
|
||||
register char *control;
|
||||
register char *string;
|
||||
{
|
||||
while (*string && *control)
|
||||
{
|
||||
if (!MatchClass(*control, *string))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
string++;
|
||||
control++;
|
||||
}
|
||||
|
||||
if (*string || *control)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* This program is copyright Alec Muffett 1993. The author disclaims all
|
||||
* responsibility or liability with respect to it's usage or its effect
|
||||
* upon hardware or computer systems, and maintains copyright as set out
|
||||
* in the "LICENCE" document which accompanies distributions of Crack v4.0
|
||||
* and upwards.
|
||||
*/
|
||||
|
||||
#include "packer.h"
|
||||
|
||||
static char vers_id[] = "stringlib.c : v2.3p2 Alec Muffett 18 May 1993";
|
||||
|
||||
char
|
||||
Chop(register char *string)
|
||||
{
|
||||
register char c;
|
||||
register char *ptr;
|
||||
c = '\0';
|
||||
|
||||
for (ptr = string; *ptr; ptr++);
|
||||
if (ptr != string)
|
||||
{
|
||||
c = *(--ptr);
|
||||
*ptr = '\0';
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
char *
|
||||
Trim(register char *string)
|
||||
{
|
||||
register char *ptr;
|
||||
for (ptr = string; *ptr; ptr++);
|
||||
|
||||
while ((--ptr >= string) && isspace(*ptr));
|
||||
|
||||
*(++ptr) = '\0';
|
||||
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
char *
|
||||
Clone (char *string)
|
||||
{
|
||||
register char *retval;
|
||||
retval = (char *) malloc(strlen(string) + 1);
|
||||
if (retval)
|
||||
{
|
||||
strcpy(retval, string);
|
||||
}
|
||||
return (retval);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue