Index ] [ Anonymity ] [ Privacy ] [ Security ] [ Search ] [ Feedback ] [ Index ] [ Anonymity ] [ Privacy ] [ Security ] [ Search ] [ Feedback ]

AppleScripts to automate nym usage

These two Applescripts can encrypt and decrypt email messages for sending and receiving through anonymous remailers.

NYM.Decrypt

-- This AppleScript is designed to decrypt email messages that have been sent by
-- a NYM remailer using PGP and passed through multiple PGP remailers before
-- reaching you.
-- 
-- Requirements:
--     AppleScript
--         This script uses the off-the-shelf Scripting Additions from System 7.6.x
--         **You must have a working knowledge of AppleScript (and/or common sense)
--     FatMacPGP.263 (WILL NOT WORK WITH MacPGP.262)
--         **You must have a working knowledge of PGP -- NO FREE TECH SUPPORT!!!!
--     Eudora 3.1 or EudoraLite 3.1
-- 
-- Configuration:
--     If you have no idea what a NYM is or what I mean by "Remailer," then go here:
--         <http://www.stack.nl/~galactus/remailers/>
--     If you have set up a NYM account and followed the instructions in the article:
--         "Nym creation and use for mere mortals"
--         <http://www.stack.nl/~galactus/remailers/nym.html>
--     then, all you have to do is edit the passphrases in the very last sub-routine
--     of this script, doPGPStuff.  Leave it alone or remove the passwords if you want PGP to
--     request a passphrase each time.  You can add remailers by duplicating the indicated 
--     command block and relinking the cascade.  You can also change the Type and Creator
--     of the file output in the doFileEnd sub-routine.  Compile as application.
--     ****  SET THE "Preferred Size:" (Finder:Get Info...) OF THE APPLET TO 1200k  **** 
--
-- Usage:
--     Select a message in Eudora.  Run Script Applet.
--         Applet runs one at a time in Eudora (complain to Qualcomm).
--         Try out OSA Menu if you want the Applet on a menu in Eudora.
--     Drop multiple TEXT files or folders on Applet in Finder.
--         You can drag and drop Eudora messages onto the Finder one at a time.
--         You can't use a selection dialog (complain to Apple).
--
-- Shareware Cost:
--     Help keep the Congress from walking the streets at night ...
--     Send a dirty picture of the Congressman of your choice to a lobbyist today!
--
--     This AppleScript is provided "AS IS" and without warrantee.  You assume all
--     liability, direct and indirect, related to its use.  It is only a template
--     for your inspection.
--     ****  NO TECH SUPPORT IS AVAILABLE!!  (Unless you want to pay for it)  ****
--     You agree to distribute this AppleScript only in its UNMODIFIED form, exactly
--     as it is now including this description in its entirety.  This script should
--     always be bundled with its encryption counterpart, NYM.Encrypt.txt.
--     When in Los Angeles, for Apple Network and System Consulting:
--         Contact:   designr@designr.com    http://www.designr.com


global messagestatus, messageFrom, messageSender, boxstatus, objectDef

on open DropList
	repeat with objectRef in DropList
		set itsInfo to (info for objectRef)
		if folder of itsInfo then
			searchFolder(objectRef as string)
		else if file type of itsInfo is "TEXT" then
			doFileStuff(objectRef as string)
		end if
	end repeat
	tell application "FatMacPGP.263"
		quit
	end tell
end open

--

on searchFolder(whatFolder)
	if last character of whatFolder is not ":" then
		set whatFolder to whatFolder & ":"
	end if
	set folderListing to (list folder of file whatFolder)
	repeat with thisFolder in folderListing
		set itsName to whatFolder & contents of thisFolder
		set itsInfo to (info for file itsName)
		if folder of itsInfo then
			searchFolder(itsName)
		else
			if file type of itsInfo is "TEXT" then
				doFileStuff(whatFolder & thisFolder as string)
			end if
		end if
	end repeat
end searchFolder

--

on run
	tell application "Finder"
		set test to get processes
	end tell
	if (test as string) contains "eudora" then
		doEudoraStuff()
	else
		display dialog "To run this script:" & return & "     1)  Activate from within Eudora or" & return & 
			"     2)  Drop encrypted text files or folders." buttons ("OK")
	end if
end run

--
--

on doFileStuff(what)
	set objectDef to what
	try
		open for access alias what
		set crypttext to read alias what
		close access file what
	on error errText number errNum
		close access file what
		display dialog errText
	end try
	if crypttext does not contain "--BEGIN PGP MESSAGE--" then
		display dialog "Select a PGP Encrypted NYM/Remailer file." buttons {"Continue", "Cancel"} default button "Continue"
		return
	end if
	set bounce to "Files"
	doPGPStuff(crypttext, bounce)
end doFileStuff

--

on doFileEnd(finaltext, slip)
	if slip is "Fail" then
		return
	end if
	get info for objectDef
	set fileName to name of result
	tell current application
		activate
		try
			copy (new file with prompt "Save Decrypted File as:" default name fileName & ".decrypt") as string to DataAlias
		on error errText number errNum
			if errNum is -128 then
				return
			else
				display dialog errText
			end if
		end try
	end tell
	try
		open for access file (DataAlias) with write permission
		set eof of file (DataAlias) to 0
		write finaltext to file (DataAlias) starting at 0
		close access file (DataAlias)
		-- Set final file types here ... you figure out how.
		tell application "Finder"
			set creator type of file (DataAlias) to "R*ch"
			set file type of file (DataAlias) to "TEXT"
		end tell
	on error errText number errNum
		close access file (DataAlias)
		display dialog errText
	end try
	set finaltext to ""
end doFileEnd

--
--

on doEudoraStuff()
	tell application "Eudora Pro 3.1"
		activate
		try
			set messagestatus to id of message named ""
		on error
			display dialog "Please select or open a message." buttons ("OK")
			error number -128
		end try
		try
			set boxstatus to mailbox of message messagestatus
		on error
			display dialog "Please select or open a message." buttons ("OK")
			error number -128
		end try
		try
			get field "From" of message messagestatus
			set messageFrom to text from word 2 to last character of result
		on error
			set messageFrom to ""
		end try
		try
			set messageSender to sender of message messagestatus
		on error
			set messageSender to ""
		end try
		try
			set crypttext to the body of message messagestatus
		on error
			set crypttext to ""
		end try
		if crypttext does not contain "--BEGIN PGP MESSAGE--" then
			display dialog "Select a PGP Encrypted NYM/Remailer file." buttons ("OK") default button "OK"
			error number -128
		end if
	end tell
	set bounce to "Eudora"
	doPGPStuff(crypttext, bounce)
end doEudoraStuff

--

on doEudoraEnd(finaltext, slip)
	tell application "FatMacPGP.263"
		quit
	end tell
	if slip is "Fail" then
		return
	end if
	tell application "Eudora Pro 3.1"
		activate
		close message messagestatus
		set Decryption to make new message at end of mailbox "Out"
		set field "Subject" of message Decryption to "Decrypted"
		set field "From" of message Decryption to messageFrom
		set body of message Decryption to finaltext
		move message Decryption to end of boxstatus
		set status of last message of boxstatus to "read"
		set sender of last message of boxstatus to messageSender
		open last message of boxstatus
	end tell
	set finaltext to ""
end doEudoraEnd

--
--

on doPGPStuff(crypttext, bounce)
	set slip to ""
	try
		-- Insert this block once FOR EACH REMAILER between NYM and YOU
		-- Be Sure to cascade the links if you add more remailers.
		tell application "FatMacPGP.263"
			activate
			-- This line decrypts with the passphrase for your HUGE.CAJONES Public Key
			set crypt1 to decryptData crypttext Password "teafortwo"
		end tell
		
		-- Insert this block ONCE for NYM'S KEY
		tell application "FatMacPGP.263"
			activate
			-- This line decrypts with the passphrase for your NYM Public Key
			set cryptNym to decryptData crypt1 Password "teafortwo"
		end tell
		
		-- Insert this block ONCE for YOUR KEYS
		tell application "FatMacPGP.263"
			activate
			-- This line decrypts with the passphrase for YOUR Secret Key
			set finaltext to decryptData cryptNym Password "BubbasPassword"
		end tell
	on error
		set slip to "Fail"
		set crypttext to ""
		set crypt1 to ""
		set cryptNym to ""
		set finaltext to ""
		if bounce is "Eudora" then
			doEudoraEnd(finaltext, slip)
		else
			doFileEnd(finaltext, slip)
		end if
	end try
	set crypttext to ""
	set crypt1 to ""
	set cryptNym to ""
	if bounce is "Eudora" then
		doEudoraEnd(finaltext, slip)
	else
		doFileEnd(finaltext, slip)
	end if
end doPGPStuff

NYM.Encrypt


-- This AppleScript is designed to encrypt email messages for sending through
-- multiple PGP remailers, ultimately to a NYM remailer using PGP which recognizes
-- your signature.
-- 
-- Requirements:
--     AppleScript
--         This script uses the off-the-shelf Scripting Additions from System 7.6.x
--         **You must have a working knowledge of AppleScript (and/or common sense)
--     FatMacPGP.263 (WILL NOT WORK WITH MacPGP.262)
--         **You must have a working knowledge of PGP -- NO FREE TECH SUPPORT!!!!
--     Eudora 3.1 or EudoraLite 3.1
-- 
-- Configuration:
--     If you have no idea what a NYM is or what I mean by "Remailer," then go here:
--         <http://www.stack.nl/~galactus/remailers/>
--     If you have set up a NYM account and followed the instructions in the article:
--         "Nym creation and use for mere mortals"
--         <http://www.stack.nl/~galactus/remailers/nym.html>
--     then, all you have to do is edit YOUR ID and passphrase in the very last sub-routine
--     of this script, doPGPStuff.  Remove the password if want PGP to request a passphrase
--     each time you encrypt a message.  You can add remailers by duplicating the indicated 
--     command blocks and relinking the cascade.  You can also change the Type and Creator
--     of the file output in the doFileEnd sub-routine.  Compile as application.
--     ****  SET THE "Preferred Size:" (Finder:Get Info...) OF THE APPLET TO 1200k  **** 
--     ****  This script adds header blocks as it encrypts and expects the TEXT message
--     ****  to begin with the first "F" from the header block for the final NYM remailer:
--
--                  From: bubba
--                  To: mail2news@anon.lcs.mit.edu
--                  Newsgroups: alt.conspiracy, alt.conspiracy.cia
--                  CC: president@whitehouse.gov
--                  Subject: And, so forth...
--
-- Usage:
--     Select a message in Eudora.  Run Script Applet.
--         Applet runs one at a time in Eudora (complain to Qualcomm).
--         Try out OSA Menu if you want the Applet on a menu in Eudora.
--     Drop multiple TEXT files or folders on Applet in Finder.
--         You can drag and drop Eudora messages onto the Finder one at a time.
--         You can't use a selection dialog (complain to Apple).
--
-- Shareware Cost:
--     Help keep the Congress from walking the streets at night ...
--     Send a dirty picture of the Congressman of your choice to a lobbyist today!
--
--     This AppleScript is provided "AS IS" and without warrantee.  You assume all
--     liability, direct and indirect, related to its use.  It is only a template
--     for your inspection.
--     ****  NO TECH SUPPORT IS AVAILABLE!!  (Unless you want to pay for it)  ****
--     You agree to distribute this AppleScript only in its UNMODIFIED form, exactly
--     as it is now including this description in its entirety.  This script should
--     always be bundled with its decryption counterpart, NYM.Decrypt.txt.
--     When in Los Angeles, for Apple Network and System Consulting:
--         Contact:   designr@designr.com    http://www.designr.com


global objectDef

on open DropList
	repeat with objectRef in DropList
		set itsInfo to (info for objectRef)
		if folder of itsInfo then
			searchFolder(objectRef as string)
		else if file type of itsInfo is "TEXT" then
			doFileStuff(objectRef as string)
		end if
	end repeat
	tell application "FatMacPGP.263"
		quit
	end tell
end open

--

on searchFolder(whatFolder)
	if last character of whatFolder is not ":" then
		set whatFolder to whatFolder & ":"
	end if
	set folderListing to (list folder of file whatFolder)
	repeat with thisFolder in folderListing
		set itsName to whatFolder & contents of thisFolder
		set itsInfo to (info for file itsName)
		if folder of itsInfo then
			searchFolder(itsName)
		else
			if file type of itsInfo is "TEXT" then
				doFileStuff(whatFolder & thisFolder as string)
			end if
		end if
	end repeat
end searchFolder

--

on run
	tell application "Finder"
		set test to get processes
	end tell
	if (test as string) contains "eudora" then
		doEudoraStuff()
	else
		display dialog "To run this script:" & return & "     1)  Activate from within Eudora or" & return & 
			"     2)  Drop text files or folders." buttons ("OK")
	end if
end run

--
--

on doFileStuff(what)
	set objectDef to what
	try
		open for access alias what
		set firsttext to read alias what
		close access file what
	on error errText number errNum
		close access file what
		display dialog errText
	end try
	set bounce to "Files"
	doPGPStuff(firsttext, bounce)
end doFileStuff

--

on doFileEnd(finaltext, slip)
	if slip is "Fail" then
		return
	end if
	get info for objectDef
	set fileName to name of result
	tell current application
		activate
		try
			copy (new file with prompt "Save Encrypted File as:" default name fileName & ".encrypt") as string to DataAlias
		on error errText number errNum
			if errNum is -128 then
				return
			else
				display dialog errText
			end if
		end try
	end tell
	try
		open for access file (DataAlias) with write permission
		set eof of file (DataAlias) to 0
		write finaltext to file (DataAlias) starting at 0
		close access file (DataAlias)
		-- Set final file types here ... you figure out how.
		tell application "Finder"
			set creator type of file (DataAlias) to "R*ch"
			set file type of file (DataAlias) to "TEXT"
		end tell
	on error errText number errNum
		close access file (DataAlias)
		display dialog errText
	end try
	set finaltext to ""
end doFileEnd

--
--

on doEudoraStuff()
	tell application "Eudora Pro 3.1"
		activate
		try
			set messagestatus to id of message named ""
		on error
			display dialog "Please select or open a message." buttons ("OK")
			error number -128
		end try
		try
			set boxstatus to mailbox of message messagestatus
		on error
			display dialog "Please select or open a message." buttons ("OK")
			error number -128
		end try
		set firsttext to the body of message named ""
	end tell
	set bounce to "Eudora"
	doPGPStuff(firsttext, bounce)
end doEudoraStuff

--

on doEudoraEnd(finaltext, slip)
	tell application "FatMacPGP.263"
		quit
	end tell
	if slip is "Fail" then
		return
	end if
	tell application "Eudora Pro 3.1"
		activate
		set Decryption to make new message at end of mailbox "Out"
		set field "To" of message Decryption to "remailer@huge.cajones.com"
		set body of message Decryption to finaltext
		open last message of mailbox "Out"
	end tell
	set finaltext to ""
end doEudoraEnd

--
--

on doPGPStuff(firsttext, bounce)
	set slip to ""
	try
		tell application "FatMacPGP.263"
			activate
			-- This line encrypts with the NYM Public Key (send@nym.alias.net) and Signs with "Bubba" using "BubbasPassword".
			set nymtext to encryptData firsttext to "send@nym.alias.net" userid "Bubba" Password "BubbasPassword" writing asciified
		end tell
		
		-- Insert next two blocks once FOR EACH REMAILER between NYM and YOU.  Be Sure to cascade the links if you add more remailers.
		
		-- This line sticks the command block that Huge.Cajones.Com sees on the front of your encrypted and signed message.
		set secondtext to "::" & return & "Request-Remailing-To: send@nym.alias.net" & return & return & nymtext
		
		tell application "FatMacPGP.263"
			activate
			-- This line encrypts with the Huge.Cajones Public Key (remailer@huge.cajones.com) without signing.
			set remail1 to encryptData secondtext to "remailer@huge.cajones.com" writing asciified
		end tell
		
		-- This line sticks the command block that tells Huge.Cajones.Com to decrypt the message on the front of your final encryption.
		set finaltext to "::" & return & "Encrypted: PGP" & return & return & remail1
	on error
		beep
		set slip to "Fail"
		set firsttext to ""
		set nymtext to ""
		set secondtext to ""
		set remail1 to ""
		set finaltext to ""
		if bounce is "Eudora" then
			doEudoraEnd(finaltext, slip)
		else
			doFileEnd(finaltext, slip)
		end if
	end try
	set firsttext to ""
	set nymtext to ""
	set secondtext to ""
	set remail1 to ""
	if bounce is "Eudora" then
		doEudoraEnd(finaltext, slip)
	else
		doFileEnd(finaltext, slip)
	end if
end doPGPStuff

HTML 3.2 Checked!
Last modified: 25 May 1997
Author: designr@netcom.com
Comments: galactus@stack.nl
This document was generated with Orb v1.3 for OS/2.