Skip to content

Commit 12deb62

Browse files
author
8go
authored
Pyqt5 (#11)
* Ported TrezorPass to from Python 2.7 to Python 3.4+. * It works now on both, Python 2.7 and Python 3.4+. * Ported from PyQt4 and Qt4 to PyQt5 and Qt5. * It does no longer support PyQt4/Qt4. * Unicode character can now be used everywhere: groupnames, keys, passwords, comments, csv import fields, csv export fields, etc. * Bug fixes: csv export did not handle "\ pattern correctly * Miscellaneous improvements. * Improved inline documentation * improved logging
1 parent b0dd949 commit 12deb62

22 files changed

+3141
-1517
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ build/
1313
dist/
1414
TrezorPass.spec
1515

16-
trezorpass.csv
16+
trezorpass.csv.org
17+
1718
keepass2.xml
19+
trezorpass.csv
20+

Makefile

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
UI_GENERATED := \
2-
ui_mainwindow.py \
3-
ui_addgroup_dialog.py \
2+
ui_main_window.py \
3+
ui_initialize_dialog.py \
4+
ui_add_group_dialog.py \
5+
ui_add_password_dialog.py \
6+
ui_trezor_chooser_dialog.py \
7+
ui_trezor_pin_dialog.py \
48
ui_trezor_passphrase_dialog.py \
5-
ui_add_password_dialog.py \
6-
ui_initialize_dialog.py \
7-
ui_enter_pin_dialog.py \
8-
ui_trezor_chooser_dialog.py \
99
#end of UI_GENERATED
1010

1111
all: $(UI_GENERATED)
1212

1313
ui_%.py: %.ui
14-
pyuic4 -o $@ $<
14+
pyuic5 -o $@ $<
1515

1616

1717
clean:
18-
rm -rf $(UI_GENERATED)
18+
rm -f $(UI_GENERATED)
19+
rm -f *.pyc
20+
rm -rf __pycache__

README.md

+66-18
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ TrezorPass is a PyQt-based password manager that uses the [Trezor](http://www.tr
77
hardware token to do encryption of passwords. It is similar to KeepassX or
88
kwalletmanager in function. It can store passwords, logons, URLs, PINs, comments, etc.
99

10-
The Password database is stored in encrypted form in a single file on computer.
11-
No access to internet is required for its use. It allows an unlimited
10+
The Password database is stored in encrypted form in a single file on your computer.
11+
No access to the internet is required for its use. It allows an unlimited
1212
count of password entries to be stored and enables the possibility of recovery
1313
if your original Trezor is misplaced (mnemonic and passphrase are required to recover).
1414

15-
Note that this is alpha software.
16-
17-
Trezor must be already set up to use passphrase.
18-
1915
Below a sample screenshot. More screenshots [here](screenshots).
2016

2117
![Screenshot](screenshots/trezorpass-screenshot-mainwindow-mainmenu-v3.png)
@@ -45,28 +41,45 @@ Below a sample screenshot. More screenshots [here](screenshots).
4541

4642
# Runtime requirements
4743

48-
* Python 2.7
49-
* PyCrypto
50-
* PyQt4
51-
* [trezorlib from python-trezor](https://github.com/trezor/python-trezor)
44+
* Use of passphrases must have been already enabled on your [Trezor](https://www.trezor.io) device.
45+
* [Trezor](https://www.trezor.io) device
46+
* [Python](https://www.python.org/) v2.7 or 3.4+
47+
* [PyCrypto](https://pypi.python.org/pypi/pycrypto)
48+
* [PyQt5](https://pypi.python.org/pypi/PyQt5)
49+
* [Qt5](https://doc.qt.io/qt-5/)
50+
* [trezorlib from python-trezor](https://github.com/trezor/python-trezor)
51+
* [Versions 0.5.0 and older used PyQy4 instead of PyQy5. Read the README.md
52+
file of v0.5.0 for build requirements, dependencies, etc. Basically anything
53+
relating to PyQt5 has to be replaced with the corresponding component in PyQt4.
54+
`pyuic5` becomes `pyuic4`. `pyqt5-dev-tools` becomes `pyqt4-dev-tools`
55+
and so forth.]
5256

5357
# Building
5458

55-
Even though the whole code is in Python, there are few Qt .ui form files that
56-
need to be transformed into Python files. There's Makefile, you just need to run
59+
Even though the whole code is in Python, there are few Qt5 `.ui` form files that
60+
need to be transformed into Python files. There is `Makefile`, you just need to run
5761

5862
make
5963

6064
## Build requirements
6165

62-
PyQt4 development tools are necessary, namely `pyuic4` (look for packages named
63-
like `pyqt4-dev-tools` or `PyQt4-devel`).
66+
* PyQt5 development tools are necessary, namely `pyuic5` (look for a package named
67+
`pyqt5-dev-tools`, `PyQt5-devel` or similar). Required to run `make`.
68+
* Depending on one's set-up one might need: `qttools5-dev-tools`
69+
(also sets up some of the Qt5 environment variables)
70+
* Depending on one's set-up one might need: `python-pyqt5` (Qt5 bindings for Python 2)
71+
* Depending on one's set-up one might need: `python3-pyqt5` (Qt5 bindings for Python 3)
72+
* Depending on one's set-up one might need: `python-pyqt5.qtsvg` (to display SVG logos in Python 2)
73+
* Depending on one's set-up one might need: `python3-pyqt5.qtsvg` (to display SVG logos in Python 3)
6474

6575
# Running
6676

6777
Run:
6878

6979
python TrezorPass.py
80+
or
81+
82+
python3 TrezorPass.py
7083

7184
On rare occasions one of the command line arguments might become useful:
7285

@@ -111,6 +124,15 @@ See also [gpg on Trezor](https://github.com/romanz/trezor-agent/).
111124

112125
# FAQ - Frequently Asked Questions
113126

127+
**Question:** Can I help or contribute?
128+
129+
**Answer:**
130+
131+
Yes, you can. It would help a lot if you assist in getting the word out.
132+
If you like the tool or like the idea please spread the word on Twitter, Reddit,
133+
Facebook, etc. It will be appreciated. Furthermore, you can blog about it,
134+
give feedback, review the code, contribute to the code, etc.
135+
- - -
114136
**Question:** I read something about an RSA key somewhere? Do I need to
115137
create it? Can I use my own? Where is it? How many bits is it?
116138

@@ -148,7 +170,7 @@ This string is stored in the QQtCore.QSettings.
148170
- - -
149171
**Question:** In which language is TrezorPass written?
150172

151-
**Answer:** [Python](https://www.python.org/) 2.7. It will currently not run on Python 3.
173+
**Answer:** [Python](https://www.python.org/). It run on Python 2.7 and 3.4+.
152174
- - -
153175
**Question:** Do I need to have a [Trezor](https://www.trezor.io/) in order to use TrezorPass?
154176

@@ -216,7 +238,7 @@ This string is stored in the QQtCore.QSettings.
216238
- - -
217239
**Question:** Is TrezorPass portable?
218240

219-
**Answer:** Yes. You can have all information on 2 files: the TrezorPass application and the password database file. Copy the 2 files (executable and data) onto a USB stick or SD card and carry them with you together with your Trezor. (Maybe in the future the files might be stored on the Trezor 2 on-device storage? Who knows?)
241+
**Answer:** Yes. You can have all information on 2 files: the TrezorPass application and the password database file. Copy the 2 files (executable and data) onto a USB stick or SD card and carry them with you together with your Trezor. (Maybe in the future the files might be stored on the `Trezor 2` on-device storage? Pure speculation but Who knows?)
220242
- - -
221243
**Question:** Can I use TrezorPass on multiple computers? Can I sync it on multiple devices/computers?
222244

@@ -319,7 +341,7 @@ convertKeePass2XmlToTrezorPassCsv.py [-v] [-h] [-i <keepass2.xml>] [-o <trezorpa
319341
- - -
320342
**Question:** What if I lose my password database file?
321343

322-
**Answer:** Then you lost all your passwords. The passwords are **not** stored on the Trezor. The passwords are only stored in the password database file. So keep it safe. (Trezor 2 does not exist yet, but it might come with on-device storage in the future. In this future case you might store a copy of the password database file on the device. But even then you should keep a copy somewhere else as well.)
344+
**Answer:** Then you lost all your passwords. The passwords are **not** stored on the Trezor. The passwords are only stored in the password database file. So keep it safe. (`Trezor 2` does not exist yet, but it might come with on-device storage in the future. In this future case you might store a copy of the password database file on the device. But even then you should keep a copy somewhere else as well.)
323345
- - -
324346
**Question:** Should I backup my password database file?
325347

@@ -331,7 +353,22 @@ convertKeePass2XmlToTrezorPassCsv.py [-v] [-h] [-i <keepass2.xml>] [-o <trezorpa
331353
- - -
332354
**Question:** On which platforms, operating systems is TrezorPass available?
333355

334-
**Answer:** On all platforms, operating systems where [Python](https://www.python.org/) 2.7 and [PyQt](https://en.wikipedia.org/wiki/PyQt) v4 is available: Windows, Linux, Unix, Mac OS X. Internet searches show Python and PyQt solutions for Android and iOS, but it has not been investigated or tested on Android or iOS.
356+
**Answer:** On all platforms, operating systems where [Python](https://www.python.org/) 2.7 or 3.4+ and [PyQt](https://en.wikipedia.org/wiki/PyQt) v5 is available: Windows, Linux, Unix, Mac OS X. Internet searches show Python and PyQt solutions for Android and iOS, but it has not been investigated, built or tested on Android or iOS. It was only tested on Linux.
357+
- - -
358+
**Question:** Can I run on Qt4?
359+
360+
**Answer:** Yes, there is an old version (v3.0) that supports Qt4. Newer versions do not support PyQt4 but require PyQt5.
361+
- - -
362+
**Question:** Can I migrate from Python 2 to Python 3?
363+
364+
**Answer:** Yes, TrezorPass runs on both. So, you easily move your environment from Python 2 to Python 3.
365+
- - -
366+
**Question:** Can I migrate from Python 3 back to Python 2?
367+
368+
**Answer:** TrezorPass runs on both but the implementation of `pickle` is different on both versions.
369+
The TrezorPass passwordd database file uses `pickle`. When you move from Python 3 back to Python 2 and
370+
then want to run TrezorPass, you will get the error message `Critical: Could not decrypt passwords: unsupported pickle protocol: 4`and the program aborts. The workaround is to export your database to a CSV file in Python 3, then start with
371+
an empty database file in Python 2 and import the CSV file. Then you are ready to go.
335372
- - -
336373
**Question:** Are there any warranties or guarantees?
337374

@@ -341,3 +378,14 @@ convertKeePass2XmlToTrezorPassCsv.py [-v] [-h] [-i <keepass2.xml>] [-o <trezorpa
341378

342379
**Answer:** Let us know.
343380
- - -
381+
382+
# To-do List
383+
384+
- [ ] Spread the information about the availability of this tool on social
385+
networks like Reddit, Twitter or Facebook. Any help appreciated.
386+
- [ ] Add a `Show All` right-click item in the password list to show all passwords and all comments with one click.
387+
- [ ] Add command line arguments to the CLI such as `--add group key password comment`,
388+
`--show group key`, `--showcomments group key` or `--delete group [key]` and using `xsel` even `--paste group key`.
389+
- [ ] Add `Rename group` to group menu
390+
391+
</> on :octocat: with :heart:

0 commit comments

Comments
 (0)