-
Notifications
You must be signed in to change notification settings - Fork 1
/
priv2txt
87 lines (64 loc) · 2.09 KB
/
priv2txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#/usr/bin/bash
# This script will export your private key to a text file for backup.
# DO NOT SHOW YOUR PRIVATE KEY TO ANYONE.
clear;
# if we ran the script on accident then exit
zenity \
--question \
--text "Are you sure you want to export your private key?" \
--ok-label "Yes" \
--cancel-label "Cancel" \
2>/dev/null;
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
clear;
zenity \
--info \
--title "Private Key Export" \
--text='DO NOT SHOW YOUR PRIVATE KEYS ANYONE.' \
2>/dev/null;
clear;
zenity \
--info \
--title "Private Key Export" \
--text='KEEP YOUR EXPORTED PRIVATE KEY IN A SECURE PLACE' \
2>/dev/null;
clear;
# Prompt user for the directory where the exported private key text file will be written to.
outputDirectory=$(zenity \
--title="Select the location where the exported private key backup file will be written" \
--file-selection \
--filename="/home/pi/" \
--directory \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
clear;
# Prompt user to specify the name for the exported private key backup file.
outputFileName=$(zenity \
--entry \
--title="Specify the name for the exported private key backup file" \
--entry-text="privatekeyexport.txt" \
--width 600 \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
clear;
# Prompt user for the email address or unique id of the private key.
uniqueID=$(zenity \
--entry \
--title="Specify the email address or uniqueID of the private key" \
--entry-text="UniqueID or Email Address" \
--width 600 \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
cd $outputDirectory;
outputPathAndFileName=$outputDirectory/$outputFileName;
gpg --export-secret-key --armor --output $outputPathAndFileName $uniqueID
clear;
echo "Private key was exported to "$outputPathAndFileName;
echo "Keep the exported private key backup file in a secure location";
echo "DO NOT SHOW YOUR PRIVATE KEY TO ANYONE";
echo "Press the ENTER key to continue";
read;