File: trad2spf

package info (click to toggle)
crack 5.0a-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,456 kB
  • ctags: 574
  • sloc: ansic: 7,444; perl: 1,316; sh: 1,053; makefile: 296
file content (65 lines) | stat: -rwxr-xr-x 1,670 bytes parent folder | download | duplicates (9)
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
#!/bin/sh
###
# This program was written by and is copyright Alec Muffett 1991,
# 1992, 1993, 1994, 1995, and 1996, and is provided as part of the
# Crack v5.0 Password Cracking package.
#
# The copyright holder disclaims all responsibility or liability with
# respect to its usage or its effect upon hardware or computer
# systems, and maintains copyright as set out in the "LICENCE"
# document which accompanies distributions of Crack v5.0 and upwards.
###

filtername=trad2spf

for file in $*
do
	if [ ! -f $file ]
	then
		echo "$filtername: $file: no such file" 1>&2
		continue
	fi

# this script provides a few basic tests in order to weed out bogus
# ciphertexts as per the "trad" unix password standard; more *may* be
# weeded out by the ELCID routine embedded in the cracker, which is
# permitted to apply more subtle rules.  Filtering done here is
# coarser, and is purely done (a) to remove gross formatting errors,
# and (b) so that load-balancing works ok.

	awk -F: '
	NF == 7 && /^\+/ && $2 == "" {
		print "E:0:ignoring passwordless nis entry: " $0
		next
	}
	NF == 7 && $2 ~ /^\*/ {
		print "E:0:ignoring locked entry: " $0
		next
	}
	NF == 7 && $2 ~ /[\-\ ]/ {
		print "E:0:ignoring locked entry: " $0
		next
	}
	NF == 7 && $2 ~ /^\[\#\!]/ {
		print "E:0:ignoring shadowed entry: " $0
		next
	}
	NF == 7 && $2 == "x" {
		print "E:0:ignoring shadowed entry: " $0
		next
	}
	NF == 7 {
		printf("D:%s:%s:%s:%s [%s %s]:%s %s\n", substr($2, 1, 2), \
		    $2, $1, $5, "'"$file"'", $7, $1, $5);
		next
	}
	{
		print "E:0:bad format: '"$file"': " $0
	}' < $file
done

# ...in hotel cells listening to dull tones,
# remote controls and cable phones...

exit 0