| 
					
				 | 
			
			
				@@ -0,0 +1,47 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#!/usr/bin/perl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use strict; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use warnings; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+my $file; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if ( ! defined $ARGV[0] ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Enter file path to encrypt: "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	my $input = <STDIN>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	chomp $input; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	$file = $input; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# Expects full path of file 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	$file = $ARGV[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if ( ! -f $file ) { die "File argument must be a plain file, $file is not a plain file or it cannot be found, exiting...\n" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+system("gpg --symmetric $file") == 0 or die "Something went wrong with GPG, I didn't encrypt the file..."; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+print "Looking for encrypted file..\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+my $newFilename = $file . ".gpg"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if ( -f $newFilename ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Encrypted file is at: $newFilename\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Something went wrong? I couldn't find the encrypted file, maybe check the dir?\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	exit 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if ( ! defined $ARGV[1] ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Want to delete the unencrypted file? (y/n)\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	my $input = <STDIN>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	chomp $input; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ( $input eq "y" ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Deleting $file ..\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		system("rm $file") == 0 or print "Something went wrong, didn't delete old file\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} elsif ( $input eq "n" ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Not deleting $file .. \n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Didn't recognize your input, skipping..\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} elsif ( defined $ARGV[1] && $ARGV[1] eq "--delete" ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Deleting $file ..\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	system("rm $file") == 0 or print "Something went wrong, didn't delete old file\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 |