home *** CD-ROM | disk | FTP | other *** search
- From: Alec.Muffett@UK.Sun.COM (Alec David Muffett)
- Newsgroups: comp.sources.misc
- Subject: v38i002: cracklib - CrackLib: A ProActive Password Security library, Part02/02
- Date: 18 Jun 1993 12:44:22 +0100
- Sender: aem@aber.ac.uk
- Approved: aem@aber.ac.uk
- Message-ID: <1vs9qm$btr@uk-usenet.UK.Sun.COM>
- X-Md4-Signature: 1bf8ce10d0606bbc653dd90603039958
-
- Submitted-by: Alec.Muffett@UK.Sun.COM (Alec David Muffett)
- Posting-number: Volume 38, Issue 2
- Archive-name: cracklib/part02
- Environment: C
-
- #! /bin/sh
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: HISTORY Makefile POSTER cracklib/Makefile
- # cracklib/genrules.pl cracklib/packer.h cracklib/stringlib.c
- # shadow/obscure.c,CL util/Makefile util/mkdict util/packer.c
- # util/testlib.c util/testnum.c util/teststr.c util/unpacker.c
- # Wrapped by alecm@uk-usenet on Fri Jun 18 12:37:28 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 2 (of 2)."'
- if test -f 'HISTORY' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'HISTORY'\"
- else
- echo shar: Extracting \"'HISTORY'\" \(148 characters\)
- sed "s/^X//" >'HISTORY' <<'END_OF_FILE'
- Xv2.5 added decent info to the "shadow" directory patches.
- X
- Xv2.4 forwarded to ch & jfh3 for beta testing/comments
- X
- Xv2.3- internal beta test versions
- END_OF_FILE
- if test 148 -ne `wc -c <'HISTORY'`; then
- echo shar: \"'HISTORY'\" unpacked with wrong size!
- fi
- # end of 'HISTORY'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(1194 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X###
- X# This program is copyright Alec Muffett 1993. The author disclaims all
- X# responsibility or liability with respect to it's usage or its effect
- X# upon hardware or computer systems, and maintains copyright as set out
- X# in the "LICENCE" document which accompanies distributions of Crack v4.0
- X# and upwards.
- X###
- X
- X###
- X# set this to the absolute path (less extn) of compressed dict.
- X
- XDICTPATH="/usr/local/lib/pw_dict"
- X
- X###
- X# Set this to the path of one or more files continaing wordlists.
- X
- XSRCDICTS=/usr/dict/words
- X###SRCDICTS=/usr/dict/words ./very-big-dict
- X
- X
- Xdefault:
- X @echo "you evidently don't know what you're doing. go read the README"
- X
- Xall:
- X ( cd cracklib && make && exit $$? )
- X ( cd util && make DICTPATH=$(DICTPATH) && exit $$? )
- X### ( cd passwd && make DICTPATH=$(DICTPATH) passwd && exit $$? )
- X touch all
- X
- Xclean:
- X -( cd cracklib && make clean && exit $$? )
- X -( cd util && make clean && exit $$? )
- X### -( cd passwd && make clean && exit $$? )
- X -rm -f all installed Part* *.BAK *.bak
- X
- Xinstall: all
- X @echo 'if "sort" dies from lack of space, see "util/mkdict"'
- X util/mkdict $(SRCDICTS) | util/packer $(DICTPATH)
- X touch installed
- X### @echo 'now go install passwd/passwd where you want it'
- END_OF_FILE
- if test 1194 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'POSTER' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'POSTER'\"
- else
- echo shar: Extracting \"'POSTER'\" \(1276 characters\)
- sed "s/^X//" >'POSTER' <<'END_OF_FILE'
- X
- XCrackLib is a library containing a C function (well, lots of functions
- Xreally, but you only need to use one of them) which may be used in a
- X"passwd"-like program.
- X
- XThe idea is simple: try to prevent users from choosing passwords that
- Xcould be guessed by "Crack" by filtering them out, at source.
- X
- XCrackLib is an offshoot of the the version 5 "Crack" software, and
- Xcontains a considerable number of ideas nicked from the new software.
- XAt the time of writing, Crack 5 is incomplete (still awaiting purchase
- Xof my home box) - but I though I could share this with you.
- X
- XNOTE THIS WELL: CrackLib is NOT a replacement "passwd" program.
- XCrackLib is a LIBRARY. CrackLib is what trendy marketdroid types would
- Xprobably call an "enabler".
- X
- XThe idea is that you wire it into your _own_ "passwd" program (if you
- Xhave source); alternatively, you wire it into something like "shadow"
- Xfrom off of the net. You can use it almost _everywhere_.
- X
- XFOR YOUR INFORMATION:
- X
- XCrackLib has been tested mostly on Suns. If you can point me at ways
- Xround portability problems (eg: static linking, other libraries, etc)
- XI'd be most grateful.
- X
- XA reference copy of CrackLib (+ large dictionary) can be found via
- Xanonymous FTP at:
- X
- X black.ox.ac.uk:~ftp/src/security/cracklib25.tar.Z
- X
- X
- X - alec
- END_OF_FILE
- if test 1276 -ne `wc -c <'POSTER'`; then
- echo shar: \"'POSTER'\" unpacked with wrong size!
- fi
- # end of 'POSTER'
- fi
- if test -f 'cracklib/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cracklib/Makefile'\"
- else
- echo shar: Extracting \"'cracklib/Makefile'\" \(492 characters\)
- sed "s/^X//" >'cracklib/Makefile' <<'END_OF_FILE'
- X###
- X# This program is copyright Alec Muffett 1993. The author disclaims all
- X# responsibility or liability with respect to it's usage or its effect
- X# upon hardware or computer systems, and maintains copyright as set out
- X# in the "LICENCE" document which accompanies distributions of Crack v4.0
- X# and upwards.
- X###
- X
- XLIB= libcrack.a
- XOBJ= fascist.o packlib.o rules.o stringlib.o
- XCFLAGS= -O -I../cracklib -DIN_CRACKLIB
- X
- X$(LIB): $(OBJ)
- X ar rv $(LIB) $?
- X -ranlib $(LIB)
- X
- Xclean:
- X -rm -f $(OBJ) $(LIB)
- END_OF_FILE
- if test 492 -ne `wc -c <'cracklib/Makefile'`; then
- echo shar: \"'cracklib/Makefile'\" unpacked with wrong size!
- fi
- # end of 'cracklib/Makefile'
- fi
- if test -f 'cracklib/genrules.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cracklib/genrules.pl'\"
- else
- echo shar: Extracting \"'cracklib/genrules.pl'\" \(992 characters\)
- sed "s/^X//" >'cracklib/genrules.pl' <<'END_OF_FILE'
- X#!/usr/local/bin/perl
- X
- X###
- X# This program is copyright Alec Muffett 1993. The author disclaims all
- X# responsibility or liability with respect to it's usage or its effect
- X# upon hardware or computer systems, and maintains copyright as set out
- X# in the "LICENCE" document which accompanies distributions of Crack v4.0
- X# and upwards.
- X###
- X
- Xsub ByLen {
- X length($a) <=> length($b);
- X}
- X
- X@a1 = ('/$s$s', '/0s0o', '/1s1i', '/2s2a', '/3s3e', '/4s4h');
- X@a2 = ('/$s$s', '/0s0o', '/1s1l', '/2s2a', '/3s3e', '/4s4h');
- X@a3 = ('/$s$s', '/0s0o', '/1s1i', '/2s2a', '/3s3e', '/4s4a');
- X@a4 = ('/$s$s', '/0s0o', '/1s1l', '/2s2a', '/3s3e', '/4s4a');
- X
- Xsub Permute {
- X local(@args) = @_;
- X local($prefix);
- X
- X while ($#args >= 0)
- X {
- X @foo = @args;
- X $prefix = "";
- X
- X while ($#foo >= 0)
- X {
- X foreach (@foo)
- X {
- X $foo{"$prefix$_"}++;
- X }
- X $prefix .= shift(@foo);
- X }
- X
- X shift(@args);
- X }
- X}
- X
- X&Permute(@a1);
- X&Permute(@a2);
- X&Permute(@a3);
- X&Permute(@a4);
- X
- Xforeach $key (sort ByLen (keys(%foo)))
- X{
- X print $key, "\n";
- X}
- END_OF_FILE
- if test 992 -ne `wc -c <'cracklib/genrules.pl'`; then
- echo shar: \"'cracklib/genrules.pl'\" unpacked with wrong size!
- fi
- chmod +x 'cracklib/genrules.pl'
- # end of 'cracklib/genrules.pl'
- fi
- if test -f 'cracklib/packer.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cracklib/packer.h'\"
- else
- echo shar: Extracting \"'cracklib/packer.h'\" \(1262 characters\)
- sed "s/^X//" >'cracklib/packer.h' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include <stdio.h>
- X
- X#define STRINGSIZE 256
- X
- Xtypedef unsigned char int8;
- Xtypedef unsigned short int int16;
- Xtypedef unsigned long int int32;
- X#ifndef NUMWORDS
- X#define NUMWORDS 16
- X#endif
- X#define MAXWORDLEN 32
- X#define MAXBLOCKLEN (MAXWORDLEN * NUMWORDS)
- X
- Xstruct pi_header
- X{
- X int32 pih_magic;
- X int32 pih_numwords;
- X int16 pih_blocklen;
- X int16 pih_pad;
- X};
- X
- Xtypedef struct
- X{
- X FILE *ifp;
- X FILE *dfp;
- X FILE *wfp;
- X
- X int32 flags;
- X#define PFOR_WRITE 0x0001
- X#define PFOR_FLUSH 0x0002
- X#define PFOR_USEHWMS 0x0004
- X
- X int32 hwms[256];
- X
- X struct pi_header header;
- X
- X int count;
- X char data[NUMWORDS][MAXWORDLEN];
- X} PWDICT;
- X
- X#define PW_WORDS(x) ((x)->header.pih_numwords)
- X#define PIH_MAGIC 0x70775631
- X
- Xextern PWDICT *PWOpen();
- Xextern char *Mangle();
- Xextern char *FascistCheck();
- X
- X#define CRACK_TOLOWER(a) (isupper(a)?tolower(a):(a))
- X#define CRACK_TOUPPER(a) (islower(a)?toupper(a):(a))
- X#define STRCMP(a,b) strcmp((a),(b))
- END_OF_FILE
- if test 1262 -ne `wc -c <'cracklib/packer.h'`; then
- echo shar: \"'cracklib/packer.h'\" unpacked with wrong size!
- fi
- # end of 'cracklib/packer.h'
- fi
- if test -f 'cracklib/stringlib.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cracklib/stringlib.c'\"
- else
- echo shar: Extracting \"'cracklib/stringlib.c'\" \(1040 characters\)
- sed "s/^X//" >'cracklib/stringlib.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xstatic char vers_id[] = "stringlib.c : v2.3p2 Alec Muffett 18 May 1993";
- X
- Xchar
- XChop(string)
- X register char *string;
- X{
- X register char c;
- X register char *ptr;
- X c = '\0';
- X
- X for (ptr = string; *ptr; ptr++);
- X if (ptr != string)
- X {
- X c = *(--ptr);
- X *ptr = '\0';
- X }
- X return (c);
- X}
- X
- Xchar *
- XTrim(string)
- X register char *string;
- X{
- X register char *ptr;
- X for (ptr = string; *ptr; ptr++);
- X
- X while ((--ptr >= string) && isspace(*ptr));
- X
- X *(++ptr) = '\0';
- X
- X return (ptr);
- X}
- X
- Xchar *
- XClone(string)
- X char *string;
- X{
- X register char *retval;
- X retval = (char *) malloc(strlen(string) + 1);
- X if (retval)
- X {
- X strcpy(retval, string);
- X }
- X return (retval);
- X}
- END_OF_FILE
- if test 1040 -ne `wc -c <'cracklib/stringlib.c'`; then
- echo shar: \"'cracklib/stringlib.c'\" unpacked with wrong size!
- fi
- # end of 'cracklib/stringlib.c'
- fi
- if test -f 'shadow/obscure.c,CL' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'shadow/obscure.c,CL'\"
- else
- echo shar: Extracting \"'shadow/obscure.c,CL'\" \(4157 characters\)
- sed "s/^X//" >'shadow/obscure.c,CL' <<'END_OF_FILE'
- X/*
- X * Copyright 1989, 1990, 1991, 1992, John F. Haugh II
- X * All rights reserved.
- X *
- X * Permission is granted to copy and create derivative works for any
- X * non-commercial purpose, provided this copyright notice is preserved
- X * in all copies of source code, or included in human readable form
- X * and conspicuously displayed on all copies of object code or
- X * distribution media.
- X */
- X
- X#include <ctype.h>
- X#ifndef BSD
- X#include <string.h>
- X#include <memory.h>
- X#else
- X#include <strings.h>
- X#define strchr index
- X#define strrchr rindex
- X#endif
- X#include "config.h"
- X
- X#ifndef lint
- Xstatic char sccsid[] = "@(#)obscure.c 3.6 20:37:32 3/7/92";
- X#endif
- X
- Xextern int getdef_bool();
- Xextern int getdef_num();
- X
- X#ifdef NEED_STRSTR
- X/*
- X * strstr - find substring in string
- X */
- X
- Xchar *
- Xstrstr (string, pattern)
- Xchar *string;
- Xchar *pattern;
- X{
- X char *cp;
- X int len;
- X
- X len = strlen (pattern);
- X
- X for (cp = string;cp = strchr (cp, *pattern);) {
- X if (strncmp (cp, pattern, len) == 0)
- X return cp;
- X
- X cp++;
- X }
- X return 0;
- X}
- X#endif
- X
- X/*
- X * Obscure - see if password is obscure enough.
- X *
- X * The programmer is encouraged to add as much complexity to this
- X * routine as desired. Included are some of my favorite ways to
- X * check passwords.
- X */
- X
- X/*ARGSUSED*/
- Xint obscure (old, new)
- Xchar *old;
- Xchar *new;
- X{
- X int i;
- X char oldmono[32];
- X char newmono[32];
- X char wrapped[64];
- X
- X if (old[0] == '\0')
- X return (1);
- X
- X if ( strlen(new) < getdef_num("PASS_MIN_LEN", 0) ) {
- X printf ("Too short. ");
- X return (0);
- X }
- X
- X /*
- X * Remaining checks are optional.
- X */
- X if ( !getdef_bool("OBSCURE_CHECKS_ENAB") )
- X return (1);
- X
- X for (i = 0;new[i];i++)
- X newmono[i] = tolower (new[i]);
- X
- X for (i = 0;old[i];i++)
- X oldmono[i] = tolower (old[i]);
- X
- X if (strcmp (new, old) == 0) { /* the same */
- X printf ("No Change. ");
- X return (0);
- X }
- X if (palindrome (newmono, oldmono)) /* a palindrome */
- X return (0);
- X
- X if (strcmp (newmono, oldmono) == 0) { /* case shifted */
- X printf ("Case changes only. ");
- X return (0);
- X }
- X if (similiar (newmono, oldmono)) /* jumbled version */
- X return (0);
- X
- X if (simple (old, new)) /* keyspace size */
- X return (0);
- X
- X strcpy (wrapped, oldmono);
- X strcat (wrapped, oldmono);
- X if (strstr (wrapped, newmono)) {
- X printf ("Rotated. ");
- X return (0);
- X }
- X
- X
- X/*
- X#define CRACKLIB_DICTPATH "/usr/local/lib/pw_dict"
- X*/
- X
- X#ifdef CRACKLIB_DICTPATH
- X {
- X char *msg;
- X
- X if (msg = (char *) FascistCheck(new, CRACKLIB_DICTPATH))
- X {
- X printf("Problem: %s. ");
- X return(0);
- X }
- X }
- X#else
- X#error /* You need to edit and uncomment the value of CRACKLIB_DICTPATH */
- X*** : this is a syntax error - it ought to balls up most compilers : ***
- X#endif /* CRACKLIB_DICTPATH */
- X
- X return (1);
- X}
- X
- X/*
- X * can't be a palindrome - like `R A D A R' or `M A D A M'
- X */
- X
- X/*ARGSUSED*/
- Xint palindrome (old, new)
- Xchar *old;
- Xchar *new;
- X{
- X int i, j;
- X
- X i = strlen (new);
- X
- X for (j = 0;j < i;j++)
- X if (new[i - j - 1] != new[j])
- X return (0);
- X
- X printf ("A palindrome. ");
- X return (1);
- X}
- X
- X/*
- X * more than half of the characters are different ones.
- X */
- X
- X/*ARGSUSED*/
- Xint similiar (old, new)
- Xchar *old;
- Xchar *new;
- X{
- X int i, j;
- X char *strchr ();
- X
- X for (i = j = 0;new[i] && old[i];i++)
- X if (strchr (new, tolower (old[i])))
- X j++;
- X
- X if (i >= j * 2)
- X return (0);
- X
- X printf ("Too similiar. ");
- X return (1);
- X}
- X
- X/*
- X * a nice mix of characters.
- X */
- X
- X/*ARGSUSED*/
- Xint simple (old, new)
- Xchar *old;
- Xchar *new;
- X{
- X int digits = 0;
- X int uppers = 0;
- X int lowers = 0;
- X int others = 0;
- X int size;
- X int i;
- X
- X for (i = 0;new[i];i++) {
- X if (isdigit (new[i]))
- X digits++;
- X else if (isupper (new[i]))
- X uppers++;
- X else if (islower (new[i]))
- X lowers++;
- X else
- X others++;
- X }
- X
- X /*
- X * The scam is this - a password of only one character type
- X * must be 8 letters long. Two types, 7, and so on.
- X */
- X
- X size = 9;
- X if (digits) size--;
- X if (uppers) size--;
- X if (lowers) size--;
- X if (others) size--;
- X
- X if (size <= i)
- X return 0;
- X
- X printf ("Too Simple. Use a longer password, or a mix of upper\n");
- X printf ("and lower case letters and numerics. ");
- X return 1;
- X}
- END_OF_FILE
- if test 4157 -ne `wc -c <'shadow/obscure.c,CL'`; then
- echo shar: \"'shadow/obscure.c,CL'\" unpacked with wrong size!
- fi
- # end of 'shadow/obscure.c,CL'
- fi
- if test -f 'util/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/Makefile'\"
- else
- echo shar: Extracting \"'util/Makefile'\" \(994 characters\)
- sed "s/^X//" >'util/Makefile' <<'END_OF_FILE'
- X###
- X# This program is copyright Alec Muffett 1993. The author disclaims all
- X# responsibility or liability with respect to it's usage or its effect
- X# upon hardware or computer systems, and maintains copyright as set out
- X# in the "LICENCE" document which accompanies distributions of Crack v4.0
- X# and upwards.
- X###
- X
- X###
- X# You MIGHT want to remove "-Bstatic" if you're not on SunOS machines.
- X# If you ARE, then leave it and suffer a few extra Kb for security's sake
- X###
- X
- XCFLAGS= -O -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"' -Bstatic
- XLIBS= ../cracklib/libcrack.a
- X
- Xall: packer unpacker testnum teststr testlib
- X touch all
- X
- Xpacker: packer.o $(LIBS)
- X cc $(CFLAGS) -o $@ $@.o $(LIBS)
- X
- Xunpacker: unpacker.o $(LIBS)
- X cc $(CFLAGS) -o $@ $@.o $(LIBS)
- X
- Xtestnum: testnum.o $(LIBS)
- X cc $(CFLAGS) -o $@ $@.o $(LIBS)
- X
- Xteststr: teststr.o $(LIBS)
- X cc $(CFLAGS) -o $@ $@.o $(LIBS)
- X
- Xtestlib: testlib.o $(LIBS)
- X cc $(CFLAGS) -o $@ $@.o $(LIBS)
- X
- Xclean:
- X -rm *.o all
- X -rm teststr testnum testlib packer unpacker
- END_OF_FILE
- if test 994 -ne `wc -c <'util/Makefile'`; then
- echo shar: \"'util/Makefile'\" unpacked with wrong size!
- fi
- # end of 'util/Makefile'
- fi
- if test -f 'util/mkdict' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/mkdict'\"
- else
- echo shar: Extracting \"'util/mkdict'\" \(583 characters\)
- sed "s/^X//" >'util/mkdict' <<'END_OF_FILE'
- X#!/bin/sh
- X
- X###
- X# This program is copyright Alec Muffett 1993. The author disclaims all
- X# responsibility or liability with respect to it's usage or its effect
- X# upon hardware or computer systems, and maintains copyright as set out
- X# in the "LICENCE" document which accompanies distributions of Crack v4.0
- X# and upwards.
- X###
- X
- X### in case of explosion, invoke "sort" with "-T" option pointing to a lot
- X### of free space in a directory somewhere.
- X
- XSORT="sort"
- X###SORT="sort -T /tmp"
- X
- Xcat $* |
- X tr '[A-Z]' '[a-z]' |
- X tr -cd '[\012a-z0-9]' |
- X $SORT |
- X uniq |
- X grep -v '^#' |
- X grep -v '^$'
- END_OF_FILE
- if test 583 -ne `wc -c <'util/mkdict'`; then
- echo shar: \"'util/mkdict'\" unpacked with wrong size!
- fi
- chmod +x 'util/mkdict'
- # end of 'util/mkdict'
- fi
- if test -f 'util/packer.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/packer.c'\"
- else
- echo shar: Extracting \"'util/packer.c'\" \(1107 characters\)
- sed "s/^X//" >'util/packer.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xint
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X int32 readed;
- X int32 wrote;
- X PWDICT *pwp;
- X char buffer[STRINGSIZE];
- X
- X if (argc <= 1)
- X {
- X fprintf(stderr, "Usage:\t%s dbname\n", argv[0]);
- X return (-1);
- X }
- X
- X if (!(pwp = PWOpen(argv[1], "w")))
- X {
- X perror(argv[1]);
- X return (-1);
- X }
- X
- X wrote = 0;
- X
- X for (readed = 0; fgets(buffer, STRINGSIZE, stdin); /* nothing */)
- X {
- X readed++;
- X
- X buffer[MAXWORDLEN - 1] = '\0';
- X
- X Chop(buffer);
- X
- X if (!buffer[0])
- X {
- X fprintf(stderr, "skipping line: %lu\n", readed);
- X continue;
- X }
- X
- X if (PutPW(pwp, buffer))
- X {
- X fprintf(stderr, "error: PutPW '%s' line %luy\n", buffer, readed);
- X }
- X
- X wrote++;
- X }
- X
- X PWClose(pwp);
- X
- X printf("%lu %lu\n", readed, wrote);
- X
- X return (0);
- X}
- END_OF_FILE
- if test 1107 -ne `wc -c <'util/packer.c'`; then
- echo shar: \"'util/packer.c'\" unpacked with wrong size!
- fi
- # end of 'util/packer.c'
- fi
- if test -f 'util/testlib.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/testlib.c'\"
- else
- echo shar: Extracting \"'util/testlib.c'\" \(687 characters\)
- sed "s/^X//" >'util/testlib.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xint
- Xmain ()
- X{
- X int32 i;
- X char buffer[STRINGSIZE];
- X
- X printf("enter potential passwords, one per line...\n");
- X
- X while (fgets (buffer, STRINGSIZE, stdin))
- X {
- X char *val;
- X
- X Chop(buffer);
- X
- X val = FascistCheck(buffer, CRACKLIB_DICTPATH);
- X
- X if (!val)
- X {
- X val = "ok";
- X }
- X printf ("%s: %s\n", buffer, val);
- X }
- X
- X return (0);
- X}
- END_OF_FILE
- if test 687 -ne `wc -c <'util/testlib.c'`; then
- echo shar: \"'util/testlib.c'\" unpacked with wrong size!
- fi
- # end of 'util/testlib.c'
- fi
- if test -f 'util/testnum.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/testnum.c'\"
- else
- echo shar: Extracting \"'util/testnum.c'\" \(811 characters\)
- sed "s/^X//" >'util/testnum.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xint
- Xmain ()
- X{
- X int32 i;
- X PWDICT *pwp;
- X char buffer[STRINGSIZE];
- X
- X if (!(pwp = PWOpen (CRACKLIB_DICTPATH, "r")))
- X {
- X perror ("PWOpen");
- X return (-1);
- X }
- X
- X printf("enter dictionary word numbers, one per line...\n");
- X
- X while (fgets (buffer, STRINGSIZE, stdin))
- X {
- X char *c;
- X
- X sscanf (buffer, "%lu", &i);
- X
- X printf ("(word %ld) ", i);
- X
- X if (!(c = (char *) GetPW (pwp, i)))
- X {
- X c = "(null)";
- X }
- X
- X printf ("'%s'\n", c);
- X }
- X
- X return (0);
- X}
- END_OF_FILE
- if test 811 -ne `wc -c <'util/testnum.c'`; then
- echo shar: \"'util/testnum.c'\" unpacked with wrong size!
- fi
- # end of 'util/testnum.c'
- fi
- if test -f 'util/teststr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/teststr.c'\"
- else
- echo shar: Extracting \"'util/teststr.c'\" \(790 characters\)
- sed "s/^X//" >'util/teststr.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xint
- Xmain ()
- X{
- X int32 i;
- X PWDICT *pwp;
- X char buffer[STRINGSIZE];
- X
- X if (!(pwp = PWOpen (CRACKLIB_DICTPATH, "r")))
- X {
- X perror ("PWOpen");
- X return (-1);
- X }
- X
- X printf("enter dictionary words, one per line...\n");
- X
- X while (fgets (buffer, STRINGSIZE, stdin))
- X {
- X int32 i;
- X
- X Chop(buffer);
- X i = FindPW(pwp, buffer);
- X printf ("%s: %lu%s\n", buffer, i, (i==PW_WORDS(pwp) ? " **** NOT FOUND ****" : ""));
- X }
- X
- X return (0);
- X}
- END_OF_FILE
- if test 790 -ne `wc -c <'util/teststr.c'`; then
- echo shar: \"'util/teststr.c'\" unpacked with wrong size!
- fi
- # end of 'util/teststr.c'
- fi
- if test -f 'util/unpacker.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/unpacker.c'\"
- else
- echo shar: Extracting \"'util/unpacker.c'\" \(866 characters\)
- sed "s/^X//" >'util/unpacker.c' <<'END_OF_FILE'
- X/*
- X * This program is copyright Alec Muffett 1993. The author disclaims all
- X * responsibility or liability with respect to it's usage or its effect
- X * upon hardware or computer systems, and maintains copyright as set out
- X * in the "LICENCE" document which accompanies distributions of Crack v4.0
- X * and upwards.
- X */
- X
- X#include "packer.h"
- X
- Xint
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X int32 i;
- X PWDICT *pwp;
- X char buffer[STRINGSIZE];
- X
- X if (argc <= 1)
- X {
- X fprintf(stderr, "Usage:\t%s dbname\n", argv[0]);
- X return (-1);
- X }
- X
- X if (!(pwp = PWOpen (argv[1], "r")))
- X {
- X perror ("PWOpen");
- X return (-1);
- X }
- X
- X for (i=0; i < PW_WORDS(pwp); i++)
- X {
- X register char *c;
- X
- X if (!(c = (char *) GetPW (pwp, i)))
- X {
- X fprintf(stderr, "error: GetPW %d failed\n", i);
- X continue;
- X }
- X
- X printf ("%s\n", c);
- X }
- X
- X return (0);
- X}
- END_OF_FILE
- if test 866 -ne `wc -c <'util/unpacker.c'`; then
- echo shar: \"'util/unpacker.c'\" unpacked with wrong size!
- fi
- # end of 'util/unpacker.c'
- fi
- echo shar: End of archive 2 \(of 2\).
- cp /dev/null ark2isdone
- MISSING=""
- for I in 1 2 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked both archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-