[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new remailing script




Here is the new sh version of the remailing script.  Enjoy!

#!/bin/sh
# support script for anonymous remailers
# allows routing a message through various remailers
# NOTE: to use extropia remailer, uncomment the appropriate lines
#       see the documentation file

#find out which mode user wants
echo "Do you want to:"
echo "1. Mail a file via anonymous remailers"
echo "2. Create a remailing header and append to a file"
echo ""
echo -n "Your choice? "
read choice

if [ "$choice" = "" -o "$choice" -lt 1 -o "$choice" -gt 2 ]
then
  echo "Error.  Improper mode selected."
  exit 1
fi

#declare remailers
[email protected]
[email protected]
[email protected]
[email protected]

#temporary files
t1=.anon1
t2=.anon2
t3=.anon3

#set up encrypted pgp header
echo "::" > $t1
echo "Encrypted: PGP" >> $t1
echo "" >> $t1

#blank out .anon3
cat /dev/null > $t3

#get final destination
if [ "$choice" -eq 1 ]
then
  echo -n "Final destination (user@host): "
else
  echo -n "Your email address (user@host): "
fi
read to

#exit if no final destination
if [ ! "$to" ]
then
  echo "Error.  No destination specified."
  exit 1
fi

#print menu
echo ""
echo "Mailing via:"
echo "1) $mail1"
echo "2) $mail2"
echo "3) $mail3"
#echo "4) $mail4"                      # uncomment to use extropia
echo ""

notdone=true

#begin loop
while [ $notdone ]
do

#find out remailing request
  echo -n "via (1-3 or q)? "
  read rto

  if [ "$rto" = "" -o "$rto" = q ]
  then
	notdone=""                     # exit while loop
  else

#convert number to address
	case "$rto"
	in
	  1) rto=$mail1;;
	  2) rto=$mail2;;
	  3) rto=$mail3;;
#	  4) rto=$mail4;;              # uncomment to use extropia
	  *) echo "Invalid menu choice."; exit;;
	esac

#set up remailing request header
	echo "::" > $t2
	echo "Request-Remailing-To: $to" >> $t2
	echo "" >> $t2

#	echo "remailing to $rto; encrypted for $to"
	cat $t3 >> $t2	               # append previous message
	pgp -ea $t2 $rto 2> /dev/null  # do the encryption
	cat $t1 $t2.asc > $t3          # prepend header to encrypted message
	to=$rto                        # save last hop
  fi
done

if [ "$choice" -eq 1 ]
then
#now include message
  echo -n "Message to include? "
  read msg
  if [ ! -f "$msg" ]
  then
    echo "Error: $msg not found"
    exit 1
  fi

  cat $msg >> $t3
  mail -s "anonymous mail" $to < $t3
  echo "Mail sent."
elif [ "$choice" -eq 2 ]
then
  echo -n "Append to file: "
  read msg
  echo "--------8<--cut here-->8--------" >> $msg
  cat $t3 >> $msg
  echo "" >> $msg
  echo "<To reply, save everything below the \"cut here\" marks above" >> $msg
  echo "<into another file.  Type your reply here (below the blank " >> $msg
  echo "<line three lines above!) and mail to $to" >> $msg
else
  echo "Error. Invalid choice."
  exit 1
fi

#clean up some of the temporary files
rm -rf $t1 $t1.asc $t2 $t2.asc