Too many iterations causing pythonista to crash (lastpass module/simple-pbkdf2)
I am trying to get the lastpass-python module working on Pythonista but it keeps on crashing Pythonista. I traced the issue down to when it tries to create a binary digest on line 124 in fetcher.py, it seems to start executing that line and then crashes. I'm guessing Pythonista has an issue storing binary data, is that a possibility?
(Obviously I downloaded all the requirements -
Edit: here's example code to execute in the console which will crash the app.
Ok I figured out the exact point of crash. When simple-pbkdf2 is creating the binary digest it iterates using the given iteration parameter. See here. Now, lastpass's "API" returns an iteration count which must be used to create the digest. However, if the iteration is greater than ~4800 then simple-pbkdf2 crashes Pythonista while iterating (runs out of memory? - I'm on iPhone 5 7.0.x). I tested with an iteration count of <=4700 and it works fine. Is there any way that this can be fixed, Ole? Or is it a hardware limitation?
It seems like
simple-pbkdf2is causing a stack overflow somewhere in
functools. There isn't much I can do about this, but I can suggest a workaround for what you're trying to do.
pbkdf2.pywith the version from the
pbkdf21.3 module and replace
fetcher.pywith the contents of my gist above (you may need to restart Pythonista in case the old modules are still cached).
I've been able to get it to work this way, hope it helps.
Awesome! It works! Thanks so much! Now I have to work on parsing and importing it into the