-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
48 lines (38 loc) · 1.33 KB
/
main.py
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
#Author: Suteerth Vishnu
#Python: version 2.7.4
#Distabution of operationg system: Linux Ubuntu 13.04(Raring Ringtail)
from sys import argv
import os
print("Do you wish to view all the keys you posses(y/n)")
inK=(raw_input().lower())
if inK == "y":
print("Press q to Quit")
os.system("gpg --list-keys|less")
print("Do you wish to encrypt\decrypt [enter E or D]:")
input=(raw_input().lower())
if input=="e":
#encrypt code
#this is to check for signing
temp=""
signing=(raw_input("Do you want to sign the message(y/n)").lower())
if signing=="y":
temp="-s"
#this is for entering the email adress
email=(raw_input("Enter email address:"))
#for chosing a location for the output file
sel=raw_input("Do you wish to save the file somwhere else(y/n)").lower
if sel =="y":
output=raw_input("Enter the file PATH in the form [ ../path/name ]")
else:
output="~/"+(raw_input("Enter output file NAME:"))
#the location of the input file
message=(raw_input("Enter the message file PATH:"))
#the actual gpg command
os.system("gpg --armour --encrypt %s --output ~/%s --recipient %s %s" % (temp,output,email,message))
elif input == "d":
pass
#decrypt code
#path to the encrypted message
mPath=(raw_input("Enter the Message PATH:"))
#decrypting..
os.system("gpg --decrypt %s" %( mPath));