forked from ryran/pyrite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyrite.py
executable file
·75 lines (57 loc) · 2.53 KB
/
pyrite.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
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
#!/usr/bin/env python3
# Copyright 2012, 2013 Ryan Sawhill Aroha <rsaw@redhat.com>
#
# License:
#
# Pyrite is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrite is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pyrite. If not, see <http://gnu.org/licenses/gpl.html>.
import argparse
from sys import argv
import pyrite.core
# Parse command-line arguments
parser = argparse.ArgumentParser(
prog='pyrite',
description="GnuPG/OpenSSL GUI to encrypt, decrypt, sign, or verify files/"
"ASCII text input.")
parser.add_argument('input', metavar='INPUT', nargs='?',
help="ascii input file to populate Message area with (NOTE"
": treatment of INPUT is modified by '-t' & '-d')")
g2 = parser.add_mutually_exclusive_group()
g2.add_argument('-d', '--direct-file', action='store_true',
help="flag INPUT as a file path to open in direct-mode")
g2.add_argument('-t', '--text-input', action='store_true',
help="flag INPUT as text instead of a file path")
g1 = parser.add_mutually_exclusive_group()
g1.add_argument('-e', '--encdec', action='store_true',
help="enable encrypt/decrypt mode")
g1.add_argument('-s', '--signverify', action='store_true',
help="enable sign/verify mode")
parser.add_argument('-c', '--symmetric', action='store_true',
help="enable symmetric encryption mode")
parser.add_argument('-r', '--recipients', metavar='RECIP',
help="recipients for asymmetric mode (semicolon-separated)")
parser.add_argument('-k', '--defaultkey', metavar='KEYUID',
help="override default gpg private key")
parser.add_argument('-b', '--backend', choices=('gpg', 'openssl'),
help="backend program to use as encryption engine")
args = parser.parse_args()
# If no cmdline options specified, let's save some cycles later
if len(argv) == 1:
args = None
if __name__ == "__main__":
p = pyrite.core.Pyrite(args)
try:
p.main()
except KeyboardInterrupt:
print()
exit()