Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #Firegpg Replacement/work around for Ubuntu GPG bug
- #by nullbyt3
- #Script Requirements: Nano/Pico text editor and obviously GnuGPG
- use strict;
- use warnings;
- system("clear");
- print "-----------------------------------------------------------\n";
- print "\t\t**Welcome to the GnuGPG **\n\t[*]File encrypter/decrypter/Key finder/Text Editor[*]\n";
- print "\n-------------------[*]by nullbyt3[*]-----------------------";
- my @options= ("1)Encrypt a file?", "2)Decrypt a file?", "3)List ALL Keys?","4)Grep for particular key?","5)Import a Key?","6)Export Public key to file?",
- "7)Delete a Key?", "7)GPG Text editor?(create a file then Encrypt/Decrypt it)"
- );
- foreach my $options(@options){
- print "\n$options\n";
- }
- print "Your choice: ";
- chomp (my $resp =<STDIN>);
- if ($resp eq "1"){
- print "File to encrypt?:";
- chomp (my $file = <STDIN>);
- print "Key to use:";
- chomp (my $key = <STDIN>);
- my $command = "gpg --recipient $key --armor --encrypt $file";
- system("$command");
- print "File successfully encrypted!\n";
- }if($resp eq "2"){
- print "File to be decrypted: ";
- chomp (my $file=<STDIN>);
- print "Output File: ";
- chomp (my $out =<STDIN>);
- my $command = "gpg --output $out --decrypt $file";
- system ("$command");
- print "[+]File decrypted successfully![+]\n";
- exit;
- }if($resp eq "3"){
- my $command = "gpg --list-keys | more";
- system("$command");
- exit;
- }if($resp eq "4"){
- print "Key to grep for?:";
- chomp (my $find =<STDIN>);
- my $command = "gpg --list-keys | grep $find";
- system("$command");
- exit;
- }if($resp eq "5"){
- print "Name of Key file?:";
- chomp (my $key =<STDIN>);
- my $command = "gpg --import $key";
- system("$command");
- print "[+]Key successfully imported![+]\n";
- exit;
- }if($resp eq "6"){
- print "Key to display?:";
- chomp (my $key=<STDIN>);
- my $command = "gpg --armor --export $key -o key.asc";
- system("$command");
- if(1){
- print "\n[+]Key successfully exported[+]\n"
- }else{ die;}
- exit;
- }if($resp eq "7"){
- print "Key to Delete from keyring?:";
- chomp(my $key_to_delete = <STDIN>);
- my $key_command = "gpg --delete-keys $key_to_delete";
- system("$key_command");
- print "[+]Key Deleted[+]\n";
- exit;
- #Line 86 Pico Text editor
- }if($resp eq "8"){
- print "File to create(gpg or txt?):";
- chomp(my $file = <STDIN>);
- if( $file eq "txt"){
- print "Name of text file?(No extensions! ie myfile):";
- chomp(my $txt = <STDIN>);
- my $command = "pico $txt.txt";
- system("$command");
- print "[+]File Created![+]\n";
- print "Would you like to encrypt the new file?:(Y or N):";
- chomp(my $ans = <STDIN>);
- if(($ans eq "y") or ($ans eq "Y")){
- print "Which key would you like to use?:";
- chomp(my $key = <STDIN>);
- my $enccmd = "gpg --recipient $key --armor --encrypt $txt.txt";
- system("$enccmd");
- print "[+]File created and Encrypted![+]\n";
- exit;
- }
- #line 108
- }
- if($file eq "gpg"){
- print "Name for the gpg file(No extensions! ie myfile):";
- chomp(my $gpg=<STDIN>);
- my $command1 = "pico $gpg.txt.gpg";
- system("$command1");
- print "[+]File Created![+]\n";
- print "Would you like to decrypt the new file?(Y or N):";
- chomp (my $ans1 = <STDIN>);
- if(($ans1 eq "y") or ($ans1 eq "Y")){
- print "outfile to use?:";
- chomp(my $out =<STDIN>);
- my $deccmd = "gpg --output $out --decrypt $gpg.txt.gpg";
- system("$deccmd");
- print "[+]file Decrypted![+]\n";
- exit;
- }
- }
- }else{
- print "[-]Error[-] Check the options and try again\n\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement