hazcod / enpass-cli

Enpass commandline client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use on Linux.

heywoodlh opened this issue · comments

The issue that I get is an "Invalid Password" error.

So with the code I added with my forks, I removed the import statement from pysqlcipher3 because it didn't work on Linux. The original import statement worked just fine on OS X.

This was the original statement:
from pysqlcipher3 import dbapi2 as sqlite

I changed it to:
from sqlite3 import dbapi2 as sqlite

Which fixed the issue described here of 'pysqlcipher3 module not found': Install Issues

However, I can't seem to decrypt the file on Linux. This is the output of the error that I get:
sqlite3.DatabaseError: file is not a database which results in an "Invalid Password" notification due to the try/except statement.

I tried using the original code from your commit history before my forks but that won't work as I keep running into the 'pysqlcipher3 module not found'.

Any ideas on knowing how to fix this on Linux? I have only tested on Ubuntu and Kali Linux. I have not tried the program on any non-Debian based Linux distros yet.

I have the exact same problem on Linux and on Mac OS.
I tried the lib pysqlcipher3 alone (under mac os) and it does work :

#!/usr/bin/env python3

from pysqlcipher3 import dbapi2 as sqlite

conn = sqlite.connect('walletx.db')
c = conn.cursor()
c.execute("PRAGMA key = 'mypass'")
c.execute("PRAGMA kdf_iter = 24000")
c.execute("""SELECT name FROM sqlite_master WHERE type='table';""")

print(c.fetchall())

c.close()

Result :

[('Identity',), ('sqlite_sequence',), ('Cards',), ('Favorites',), ('Folders',), ('Folder_Cards',), ('Pool',), ('Password_History',), ('SecuritySettings',), ('Attachment',)]

I fixed my own issue on this PR : #7

Hmm. Tried running the code on Linux didn't see a difference. Also, the repo currently works just fine for me on OS X. So I'm not sure what the difference is there.

The import statement that you used in that code is exactly the same as the current repo:

if sys.platform == 'darwin':

    from pysqlcipher3 import dbapi2 as sqlite

    def copyToClip(message):

        p = subprocess.Popen(['pbcopy'],

                            stdin=subprocess.PIPE, close_fds=True)

        p.communicate(input=message.encode('utf-8'))

Hopefully that didn't come off rude. I think your pull request is awesome! Hadn't even thought of making 'Y' the default response on the prompt to save the master password in the keychain.

I just don't know how this relates to this issue of enpass-cli not working on Linux. If you have additional insight that would help fix the Linux issue, that would be awesome. I totally would love to get this working under Linux.

I am gonna check with my linux machine on monday.

Thank you!

When I changed the linux import to :

from pysqlcipher3 import dbapi2 as sqlite

It works.

What Linux distro are you using? I have tried it on Kali Linux and Ubuntu and neither work. I'll have to stand up a new Linux VM and see if it is just my instances of Linux that are the problem.

Debian testing
Try with my sample code copied above, it's reduced to the strict minimum.

Interesting. Let me test on a new VM and I'll report back.

Still not working correctly. I changed the import statement for Linux back to

from pysqlcipher3 import dbapi2 as sqlite

The error I get is still:

ModuleNotFoundError: No module named 'pysqlcipher3'

Not only did I install the dependencies in requirements.txt which includes pysqlcipher3==1.0.2 but I tried pip install pysqlcipher3. I have tried this in both Ubuntu 16.04, and Kali Linux.

I typically use virtual environments to keep all the repos separate, but I also tried installing the requirements globally outside of the virtualenv and running outside of the virtualenv.

Any suggestions on getting around this would be appreciated! :)

I tried installing this on Linux Mint and it failed as well, the pysqlcipher3 module wouldn't install.
I needed to install python3-dev before pysqlcipher3 would install. But with the recent changes I always get the error 'Invalid Password'

pip3 install pysqlcipher3

?

Yeah I installed via pip3, not working.

the pip3 method wouldn't work until I installed python3-dev first.

@TheReptile are you able to import pyslqcipher3 from a python3 interpreter?

@heywoodlh Yes that seems to work here.

Weird. I can't seem to import it. And I've got python3-dev installed.

I just looked through my history and I also installed libsqlcipher-dev not sure if that was also needed.

Interesting. Still not working for me for some reason.

Also, can you successfully use the past versions of the repo?

https://github.com/HazCod/enpass-cli/tree/d984e7a0d2e99b637ceb4d10a8d1dd876aa8e058

Yes, the older version works for me, after I remove the hardcoded path for niels in the script
I'll check later how I managed to get this working, it caused me some pain as well.

Awesome. Thanks! Please submit a pull request when you figure out what the difference is that allows it to work on the old version vs the new version.

If you look at the history of the repo, the code I added to pass.py included a whole bunch of changes in order to optimize its usage on OS X. However, I tried to make separate the Linux code from OS X so it should have remained the same. Except for the import statement that uses this line from sqlite3 import dbapi2 as sqlite instead of from pysqlcipher3 import dbapi2 as sqlite because I couldn't get pysqlcipher3 to import on any of my Linux machines.

So I still need to figure out why I can't get pysqlcipher3 to import on my Linux machines.

Fresh install of Arch Linux, still having the problem of not being able to import pysqlcipher3. Trying to build pysqlcipher3 manually to see if that will fix the problem.

I was able to fix the issue by building pysqlcipher3 manually.

Everything works for me now. I am also going to build the option to store the master password in the keychain for Linux and submit a pull request when that is complete.

Install libsqlcipher-dev

sudo apt update
sudo apt install libsqlcipher-dev

then build pysqlcipher3 from source

git clone https://github.com/rigglemania/pysqlcipher3
cd pysqlcipher3
python setup.py build_amalgamation
python setup.py install

Done!