|
@@ -0,0 +1,34 @@
|
|
|
+#!/usr/bin/perl
|
|
|
+
|
|
|
+use strict;
|
|
|
+use warnings;
|
|
|
+
|
|
|
+my $file;
|
|
|
+if ( ! defined $ARGV[0] ) {
|
|
|
+ print "Enter file path to decrypt: ";
|
|
|
+ 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" };
|
|
|
+# Get rid of .gpg
|
|
|
+my $newFileName = $file;
|
|
|
+for ( 0 .. 3 ) {
|
|
|
+ my $char = chop($newFileName);
|
|
|
+}
|
|
|
+
|
|
|
+print "new filename is $newFileName\n";
|
|
|
+system("gpg -o $newFileName -d $file") == 0 or die "Something went wrong with GPG, I didn't decrypt the file...";
|
|
|
+
|
|
|
+print "Looking for decrypted file..\n";
|
|
|
+if ( -f $newFileName ) {
|
|
|
+ print "Unencrypted file is at: $newFileName\n";
|
|
|
+} else {
|
|
|
+ print "Something went wrong? I couldn't find the decrypted file, maybe check the dir?\n";
|
|
|
+ exit 1;
|
|
|
+}
|
|
|
+
|