[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
a couple of shell scripts for use with PGP
pgpextract: Given one or more keyids or userids, either on the command
line or on stdin, extracts the keys and writes them to stdout.
Basically just a more useful interface for 'pgp -kxa'.
pgpgetweb: Given one or more keyids or userids, either on the command
line or on stdin, expands the "web of trust" out to the specified depth
and writes the resulting keyids to stdout. You could feed the
resulting file to pgpextract to make a subset keyring of only your
'close neighbors'.
If I come up with more scripts I'll add them to the sharchive in
my ftp dir on netcom.
---
Jef
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# README
# pgpscripts.1
# Makefile
# pgpextract
# pgpgetweb
# This archive created: Mon May 16 00:11:13 1994
export PATH; PATH=/bin:$PATH
echo shar: extracting "'README'" '(536 characters)'
if test -f 'README'
then
echo shar: will not over-write existing file "'README'"
else
sed 's/^X//' << \SHAR_EOF > 'README'
X pgpscripts - shell scripts for using PGP
X version of 15may94
X
XSome simple scripts that give a more Unix-like interface to some
Xof PGP's functions. See the manual entry for more details.
X
XFiles in this distribution:
X README this
X Makefile guess
X pgpscripts.1 manual entry
X pgpextract script
X pgpgetweb ...
X
XTo install:
X Unpack the files.
X Edit the Makefile to change the configuration options if necessary.
X Make install.
X
XComments to:
X Jef Poskanzer [email protected] [email protected]
SHAR_EOF
if test 536 -ne "`wc -c < 'README'`"
then
echo shar: error transmitting "'README'" '(should have been 536 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'pgpscripts.1'" '(744 characters)'
if test -f 'pgpscripts.1'
then
echo shar: will not over-write existing file "'pgpscripts.1'"
else
sed 's/^X//' << \SHAR_EOF > 'pgpscripts.1'
X.TH pgpscripts 1 "15 May 1993"
X.SH NAME
Xpgpextract, pgpgetweb - shell scripts for using PGP
X.SH SYNOPSIS
X.B pgpextract
X.RI [ keyid... ]
X.br
X.B pgpgetweb
X.I depth
X.RI [ keyid... ]
X.SH DESCRIPTION
X.PP
XDescription of each script:
X.TP
X.I pgpextract
XGiven one or more keyids or userids, either on the command line or
Xon stdin, extracts the keys and writes them to stdout. Basically
Xjust a more useful interface for 'pgp -kxa'.
X.TP
X.I pgpgetweb
XGiven one or more keyids or userids, either on the command line or
Xon stdin, expands the "web of trust"
Xout to the specified depth and writes the resulting keyids to stdout.
XYou could feed the resulting file to
X.B pgpextract
Xto make a subset keyring of only your 'close neighbors'.
X.SH "SEE ALSO"
Xpgp(1)
SHAR_EOF
if test 744 -ne "`wc -c < 'pgpscripts.1'`"
then
echo shar: error transmitting "'pgpscripts.1'" '(should have been 744 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(592 characters)'
if test -f 'Makefile'
then
echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X# CONFIGURE: the directory where you want the executables installed
XINSTDIR = /usr/local/bin
X
X# CONFIGURE: the directory tree where you want the man pages installed
XMANDIR = /usr/local/man
X
X# End of configurable definitions.
X
XSCRIPTS = pgpextract pgpgetweb
X
Xall:
X
Xinstall: all
X for i in $(SCRIPTS) ; do \
X rm -f $(INSTDIR)/$$i ; \
X cp $$i $(INSTDIR) ; \
X done
X rm -f $(MANDIR)/man1/pgpscripts.1
X cp pgpscripts.1 $(MANDIR)/man1
X for i in $(SCRIPTS) ; do ( \
X rm -f $(MANDIR)/man1/$$i.1 ; \
X echo '.so man1/pgpscripts.1' > $(MANDIR)/man1/$$i.1 ; \
X ) done
X
Xclean:
X rm -f core
SHAR_EOF
if test 592 -ne "`wc -c < 'Makefile'`"
then
echo shar: error transmitting "'Makefile'" '(should have been 592 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'pgpextract'" '(894 characters)'
if test -f 'pgpextract'
then
echo shar: will not over-write existing file "'pgpextract'"
else
sed 's/^X//' << \SHAR_EOF > 'pgpextract'
X#!/bin/sh
X#
X# pgpextract - extract multiple pgp keys onto stdout
X#
X# Copyright (C) 1994 by Jef Poskanzer <[email protected]>.
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose and without fee is hereby granted, provided
X# that the above copyright notice appear in all copies and that both that
X# copyright notice and this permission notice appear in supporting
X# documentation. This software is provided "as is" without express or
X# implied warranty.
X
Xout=peo.$$
Xkey=pek.$$
Xkeya=${key}.asc
Xrm -f ${out} ${keya}
Xumask 077
X
X(
X if [ $# -eq 0 ] ; then
X cat
X else
X while [ $# -ne 0 ] ; do
X echo $1
X shift
X done
X fi
X) | (
X while read id ; do
X pgp -kxa ${id} ${key} > ${out} 2>&1
X if [ -z "`grep 'Key not found' ${out}`" ] ; then
X cat ${keya}
X else
X echo "Keyid ${id} not found." >&2
X fi
X rm -f ${out} ${keya}
X done
X)
SHAR_EOF
if test 894 -ne "`wc -c < 'pgpextract'`"
then
echo shar: error transmitting "'pgpextract'" '(should have been 894 characters)'
fi
chmod +x 'pgpextract'
fi # end of overwriting check
echo shar: extracting "'pgpgetweb'" '(1338 characters)'
if test -f 'pgpgetweb'
then
echo shar: will not over-write existing file "'pgpgetweb'"
else
sed 's/^X//' << \SHAR_EOF > 'pgpgetweb'
X#!/bin/sh
X#
X# pgpgetweb - finds the keyids that comprise the 'web of trust' for
X# specified ids
X#
X# Copyright (C) 1994 by Jef Poskanzer <[email protected]>.
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose and without fee is hereby granted, provided
X# that the above copyright notice appear in all copies and that both that
X# copyright notice and this permission notice appear in supporting
X# documentation. This software is provided "as is" without express or
X# implied warranty.
X
Xif [ $# -eq 0 ] ; then
X echo "usage: $0 depth [keyid...]" >&2
X exit 1
Xfi
Xdepth=$1
Xshift
X
Xids=/tmp/pgwid.$$
Xtodo=/tmp/pgwtd.$$
Xout=/tmp/pgwo.$$
Xrm -f ${ids} ${todo} ${out}
Xumask 077
X(
X if [ $# -eq 0 ] ; then
X cat
X else
X while [ $# -ne 0 ] ; do
X echo $1
X shift
X done
X fi
X) | sort -u > ${ids}
Xcat ${ids} > ${todo}
X
Xecho "Starting with `cat ${ids} | wc -l` keyids." >&2
Xn=0
Xwhile [ ${n} -lt ${depth} ] ; do
X cat ${todo} | (
X while read id ; do
X pgp -kvv ${id} 2>&1 | egrep '^sig ' | awk '{printf "0x%s\n", $2}'
X done
X ) | sort -u > ${out}
X comm -13 ${ids} ${out} > ${todo}
X cat ${ids} >> ${out}
X sort -u ${out} > ${ids}
X
X n=`echo ${n}+1 | bc`
X echo "At depth ${n}, `cat ${ids} | wc -l` keyids." >&2
Xdone
X
Xcat ${ids}
Xrm -f ${ids} ${todo} ${out}
SHAR_EOF
if test 1338 -ne "`wc -c < 'pgpgetweb'`"
then
echo shar: error transmitting "'pgpgetweb'" '(should have been 1338 characters)'
fi
chmod +x 'pgpgetweb'
fi # end of overwriting check
# End of shell archive
exit 0