Skip to content

Commit 71ec244

Browse files
author
8go
committed
v0.4, new gui with 2 columns, more GUI options, all CLI commands now available thru GUI, more logging, code cleanup, better testing
1 parent 33ada32 commit 71ec244

16 files changed

+928
-264
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Note that it is software, currently in alpha stage.
4141

4242
# Screenshot
4343

44-
Below a sample screenshot. More screenshots [here](https://github.com/8go/TrezorSymmetricFileEncryption/tree/master/screenshots).
44+
Below a sample screenshot. More screenshots [here](screenshots).
4545

46-
![screenshot](https://github.com/8go/TrezorSymmetricFileEncryption/blob/master/screenshots/screenshot_TrezorSymmetricFileEncryption_mainWindow2.version03b.png)
46+
![screenshot](screenshots/screenshot_TrezorSymmetricFileEncryption_mainWindow6.version04b.png)
4747

4848
# Build and runtime requirements
4949

@@ -74,7 +74,7 @@ Run:
7474
Run-time command line options are
7575

7676
```
77-
TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o | -e | -d | -n] [-p <passphrase>] <files>
77+
TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o | -e | -d | -m | -n] [-p <passphrase>] <files>
7878
-v, --verion
7979
print the version number
8080
-h, --help
@@ -113,9 +113,11 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o
113113
only relevant for `-e` and `-o`; ignored in all other cases.
114114
Primarily useful for testing.
115115
-w, --wipe
116-
shred the plaintext file after encryption;
117-
only relevant for `-e` and `-o`; ignored in all other cases.
118-
Use with caution. May be used together with `-s`.
116+
shred the inputfile after creating the output file
117+
i.e. shred the plaintext file after encryption or
118+
shred the encrypted file after decryption;
119+
only relevant for `-d`, `-e` and `-o`; ignored in all other cases.
120+
Use with extreme caution. May be used together with `-s`.
119121
<files>
120122
one or multiple files to be encrypted or decrypted
121123
@@ -164,6 +166,10 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o
164166
# encrypt contract and obfuscate output producing e.g. TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ
165167
TrezorSymmetricFileEncryption.py -o contract.doc
166168
169+
# encrypt contract and obfuscate output producing e.g. TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ
170+
# performs safety check and then shreds contract.doc
171+
TrezorSymmetricFileEncryption.py -e -o -s -w contract.doc
172+
167173
# decrypt contract producing contract.doc
168174
TrezorSymmetricFileEncryption.py contract.doc.tsfe
169175
@@ -172,6 +178,18 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o
172178
173179
# shows plaintext name of encrypted file, e.g. contract.doc
174180
TrezorSymmetricFileEncryption.py -n TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ
181+
182+
Keyboard shortcuts of GUI:
183+
Apply, Save: Control-A, Control-S
184+
Cancel, Quit: Esc, Control-Q
185+
Copy to clipboard: Control-C
186+
Version, About: Control-V
187+
Set encrypt operation: Control-E
188+
Set decrypt operation: Control-D
189+
Set obfuscate option: Control-O
190+
Set twice option: Control-2
191+
Set safety option: Control-T
192+
Set wipe option: Control-W
175193
```
176194

177195
# Testing

TrezorSymmetricFileEncryption.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def chooseDevice(self, devices):
147147
deviceStr = dialog.chosenDeviceStr()
148148
return HidTransport([deviceStr, None])
149149

150-
def showGui(trezor, settings, fileMap, logger, feedback):
150+
def showGui(trezor, settings, fileMap, logger):
151151
"""
152152
Initialize, ask for encrypt/decrypt options,
153153
ask for files to be decrypted/encrypted,
@@ -161,27 +161,20 @@ def showGui(trezor, settings, fileMap, logger, feedback):
161161
items selected in GUI
162162
"""
163163
dialog = Dialog(trezor, settings, fileMap, logger)
164-
settings.guiExists = True
165164
settings.settings2Gui(dialog, trezor)
166-
if settings.logger.getEffectiveLevel() <= logging.INFO:
167-
dialog.appendDescription("<br>Trezor label: " + trezor.features.label)
168-
if settings.WArg and settings.logger.getEffectiveLevel() <= logging.WARN:
169-
dialog.appendDescription("<br>Warning: The option `--wipe` is set. Plaintext files will "
170-
"be shredded after encryption. Abort if you are uncertain or don't understand.")
165+
processing.reportLogging("Trezor label: %s" % trezor.features.label, logging.INFO,
166+
"Trezor IO", settings, logger, dialog)
171167
if not dialog.exec_():
172-
settings.guiExists = False
173168
processing.reportLogging("Shutting down due to user request "
174169
"(Done/Quit was called).", logging.DEBUG,
175-
"GUI IO", settings, logger)
170+
"GUI IO", settings, logger, None)
176171
sys.exit(4) # Esc or exception
177-
settings.guiExists = False
178172
settings.gui2Settings(dialog,trezor)
179173

180174
# root
181175

182176
logging.basicConfig(stream=sys.stderr, level=basics.LOGGINGLEVEL)
183177
logger = logging.getLogger('tsfe')
184-
feedback = processing.Feedback()
185178

186179
app = QtGui.QApplication(sys.argv)
187180

@@ -204,20 +197,27 @@ def showGui(trezor, settings, fileMap, logger, feedback):
204197

205198
trezor.clear_session()
206199

207-
if settings.TArg:
208-
logger.info("Trezor label: %s", trezor.features.label)
209-
210200
fileMap = file_map.FileMap(trezor,logger)
211201

212202
# if everything is specified in the command line then do not call the GUI
213203
if ((settings.PArg is None) or (len(settings.inputFiles) <= 0)) and (not settings.TArg):
214204
# something was not specified, so we call the GUI
215-
showGui(trezor, settings, fileMap, logger, feedback)
205+
showGui(trezor, settings, fileMap, logger)
216206
else:
217-
logger.info("Everything was specified or --terminal was set, "
218-
"hence the GUI will not be called.")
207+
processing.reportLogging("Trezor label: %s" % trezor.features.label, logging.INFO,
208+
"Trezor IO", settings, logger, None)
209+
processing.reportLogging("Everything was specified or --terminal was set, "
210+
"hence the GUI will not be called.", logging.INFO,
211+
"Trezor IO", settings, logger, None)
212+
if settings.WArg:
213+
processing.reportLogging("The option `--wipe` is set. In case of "
214+
"encryption, the original plaintext files will "
215+
"be shredded after encryption. In case of decryption, "
216+
"the encrypted files will be shredded after decryption. "
217+
"Abort if you are uncertain or don't understand.", logging.WARNING,
218+
"Dangerous arguments", settings, logger, None)
219219
if settings.PArg is not None:
220220
trezor.prefillPassphrase(settings.PArg)
221221

222-
processing.processAll(trezor, settings, fileMap, logger, feedback)
222+
processing.processAll(trezor, settings, fileMap, logger, dialog=None)
223223
sys.exit(0)

basics.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
TSFEFILEFORMATVERSION = 1
88

99
# Name of software version, must be less than 16 long
10-
TSFEVERSION = "v0.3.2"
10+
TSFEVERSION = "v0.4"
11+
12+
# Date of software version, only used in GUI
13+
TSFEVERSIONTEXT = "May 2017"
1114

1215
# default log level
1316
LOGGINGLEVEL = logging.INFO # CRITICAL, ERROR, WARNING, INFO, DEBUG

0 commit comments

Comments
 (0)