pypwsafe icon indicating copy to clipboard operation
pypwsafe copied to clipboard

issue with update option in pwsafecli.py

Open makiredd opened this issue 7 years ago • 3 comments

Hi,

When I try to update .psafe3 file using below command $python pwsafecli.py get --uuid "" --password "" --file OperationsSafe2018.psafe3 2>updatePwsafe.err then OperationsSafe2018.psafe3 got corrupted and unable to get record again.

Please help. Thank you

python pwsafecli.py get --title "myserver" --username "root" --file temp.psafe3

No handlers could be found for logger "psafe.lib.record" [ Group: ['Infra Servers', 'Test Servers'] Title: myserver Username: root Password: test123 UUID: **** Note: Created: 2015-08-23 01:15:28 PasswordModified: 2017-05-19 14:42:33 EntryModified: 2018-02-22 06:40:28 LastAccess: 2018-02-22 06:40:28 Expires: 1970-01-01 00:00:00 Email: URL: AutoType: ]

python pwsafecli.py get --uuid "****" --file temp.psafe3

No handlers could be found for logger "psafe.lib.record" [ Group: ['Infra Servers', 'Test Servers'] Title: myserver Username: root Password: test123 UUID: **** Note: Created: 2015-08-23 01:15:28 PasswordModified: 2017-05-19 14:42:33 EntryModified: 2018-02-22 06:40:54 LastAccess: 2018-02-22 06:40:54 Expires: 1970-01-01 00:00:00 Email: URL: AutoType: ]

python pwsafecli.py update --uuid "****" --password "abcd1234" --file temp.psafe3

No handlers could be found for logger "psafe.lib.record"

python pwsafecli.py get --uuid "****" --file temp.psafe3

No handlers could be found for logger "psafe.lib.record" Traceback (most recent call last): File "pwsafecli.py", line 421, in main(options) File "pwsafecli.py", line 403, in main func(options) File "pwsafecli.py", line 251, in get_action safe = get_safe(options.filename, options.safe_password) File "pwsafecli.py", line 164, in get_safe mode = "RW") File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/init.py", line 211, in init self.load() File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/init.py", line 389, in load hdr = Create_Header(self._fetch_block) File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/PWSafeV3Headers.py", line 964, in Create_Header return headers[rtype](rtype, rlen, data) File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/PWSafeV3Headers.py", line 852, in init Header.init(self, htype, hlen, raw_data) File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/PWSafeV3Headers.py", line 75, in init self.parse() File "/opt/Python/2.7.14/lib/python2.7/site-packages/pypwsafe/PWSafeV3Headers.py", line 860, in parse assert len(left) % LEN == 2 AssertionError

makiredd avatar Feb 21 '18 15:02 makiredd

Hmm, I look at it, and i faced completly different issue. The functon responsible for updating is missing. There is no add_or_update_records anywhere in the code?

Traceback (most recent call last): File "/Users/krzysztof.grzempa/Projects/pypwsafe/pwsafecli/pwsafecli.py", line 422, in <module> main(options) File "/Users/krzysztof.grzempa/Projects/pypwsafe/pwsafecli/pwsafecli.py", line 404, in main func(options) File "/Users/krzysztof.grzempa/Projects/pypwsafe/pwsafecli/pwsafecli.py", line 283, in update_action add_or_update_records(safe, records[0], options) NameError: global name 'add_or_update_records' is not defined

Is it ever been created ?

Bastian82 avatar Oct 03 '22 17:10 Bastian82

Oh, there is a typo in 283 line

add_or_update_records(safe, records[0], options)

New issue for that #17

Bastian82 avatar Oct 03 '22 17:10 Bastian82

I found other problems in updating like #17 o #18 but cannot reproduce your bug presented in this issue. The assertion error is related to parsing data in PWSafeV3Headers.py:

https://github.com/ronys/pypwsafe/blob/1264bf5d33d2546dd3ca0e02937321facd6f572a/src/pypwsafe/PWSafeV3Headers.py#L860

so somehow it has get corrupted data that doesnt meet lenght criteria, but i dont know why at the moment

Bastian82 avatar Oct 03 '22 18:10 Bastian82