#!/usr/X11R6/bin/wish -f # #Version 0.02 PH 990608 # # Comments to: dirtypgp@owlriver.com # # README # # When you look at the script, you'll understand why I call this "dirty"... # Well, tcl ist not my mother tongue. There is no key management inside this # script! Learn plain pgp commands first! It was tested with PGP263i. # # Before invoking ANY (!) PGP command enter your passphrase. # If the script locks, just kill it. Your passphrase is stored somewhere # in your system - leave the script with the "forget" button. # # Fuer Umlautkonvertierung gibt es im Script eine Zeile, die mit #d# # beginnt. Kommentar loeschen und Script "killumlaut" installieren. # PGP263i hat manchmal Probleme bei Clearsig und Umlauten... # # http://195.145.169.13/~cmeyer # carsten.meyer@home.gelsen-net.de (Tue Jun 8 1999) # # Latest news: dirtypgp finally distributed under GNU General Public License # http://www.gnu.org/copyleft/gpl.txt # # Very latest news: Need someone to take over this project!!! wm title . "dirtyPGP" text .txt1 -wrap word -yscrollcommand ".scroll set" -height 30 text .stat -height 2 -foreground red scrollbar .scroll -command ".txt1 yview" pack .scroll -side right -fill y pack .txt1 .stat -expand yes -fill both frame .topframe pack .topframe -side top -fill x -pady 2m button .bdis -text "Dismiss and forget!" -command "forget" button .bent -foreground red -text "Passphrase" -command "enterpp1" button .bwip -text "wipe" -command "wipe" button .bdec -text "decrypt" -command "decrypt1" button .benc -text "sign and encrypt" -command "signenc1" button .bcle -text "clearsig" -command "clearsig1" pack .bdis .bent .bwip .bdec .benc .bcle -side left -in .topframe bind . {forget} #------------------------------------------------------- proc decrypt1 {} { global env delete set ciphertext [open $env(HOME)/.dirtypgp.asc "w+"] puts $ciphertext "[ .txt1 get 1.0 end ]" close $ciphertext catch {exec pgp $env(HOME)/.dirtypgp.asc} output wipe set pgpoutput [open $env(HOME)/.dirtypgp.out "w+"] puts $pgpoutput $output close $pgpoutput catch {exec grep from $env(HOME)/.dirtypgp.out} out .stat insert 1.0 $out\n catch {exec grep made $env(HOME)/.dirtypgp.out} out .stat insert 2.0 $out set plaintext [open $env(HOME)/.dirtypgp] .txt1 insert 0.0 [ read $plaintext ] close $plaintext } #------------------------------------------------------- proc signenc1 {} { toplevel .enterid wm title .enterid "recipient?" button .enterid.ok2 -text "OK" -state active -command { global env delete if {$herid == ""} {set herid "foo.bar"} set plaintext [open $env(HOME)/.dirtypgp "w+"] puts $plaintext "[ .txt1 get 1.0 end ]" close $plaintext catch {exec pgp -sea $env(HOME)/.dirtypgp $herid +batchmode} output set pgpoutput [open $env(HOME)/.dirtypgp.out "w+"] puts $pgpoutput $output close $pgpoutput wipe catch {exec grep ID: $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 1.0 $out\n} catch {exec grep Error $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 2.0 $out\n} catch {exec grep Cannot $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 3.0 $out\n} set ciphertext [open $env(HOME)/.dirtypgp.asc] .txt1 insert 0.0 [ read $ciphertext ] close $ciphertext destroy .enterid } entry .enterid.e2 -textvariable herid pack .enterid.e2 .enterid.ok2 -side top -pady 5 -padx 15 -fill x } #------------------------------------------------------- proc clearsig1 {} { global env delete set plaintext [open $env(HOME)/.dirtypgp "w+"] puts $plaintext "[ .txt1 get 1.0 end ]" close $plaintext #d# catch {exec killumlaut $env(HOME)/.dirtypgp} popel0 catch {exec pgp -sat +clearsig=on $env(HOME)/.dirtypgp} output set pgpoutput [open $env(HOME)/.dirtypgp.out "w+"] puts $pgpoutput $output close $pgpoutput wipe catch {exec grep ID: $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 1.0 $out\n} catch {exec grep Error $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 2.0 $out\n} catch {exec grep Cannot $env(HOME)/.dirtypgp.out} out if {[lindex $out 3] != "abnormally"} {.stat insert 3.0 $out\n} set ciphertext [open $env(HOME)/.dirtypgp.asc] .txt1 insert 0.0 [ read $ciphertext ] close $ciphertext } #------------------------------------------------------- proc enterpp1 {} { toplevel .enterpp wm title .enterpp "passphrase?" button .enterpp.ok -text "OK" -command { set env(PGPPASS) $passphrase destroy .enterpp .bent configure -foreground grey -state disabled } entry .enterpp.e1 -show "#" -textvariable passphrase pack .enterpp.e1 .enterpp.ok -side top -pady 5 -padx 15 -fill x } #------------------------------------------------------- proc forget {} { set env(PGPPASS) "passphrase deleted" delete destroy . } #------------------------------------------------------- proc wipe {} { .txt1 delete 0.0 1000.0 .stat delete 0.0 10.0 } #------------------------------------------------------- proc delete {} { global env catch {exec rm -f $env(HOME)/.dirtypgp} popel1 catch {exec rm -f $env(HOME)/.dirtypgp.asc} popel2 catch {exec rm -f $env(HOME)/.dirtypgp.pgp} popel3 catch {exec rm -f $env(HOME)/.dirtypgp.out} popel4 }