Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with update option in pwsafecli.py #13

Open
makiredd opened this issue Feb 21, 2018 · 3 comments
Open

issue with update option in pwsafecli.py #13

makiredd opened this issue Feb 21, 2018 · 3 comments

Comments

@makiredd
Copy link

makiredd commented Feb 21, 2018

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

@Bastian82
Copy link
Contributor

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
Copy link
Contributor

Bastian82 commented Oct 3, 2022

Oh, there is a typo in 283 line

add_or_update_records(safe, records[0], options)

New issue for that #17

@Bastian82
Copy link
Contributor

Bastian82 commented Oct 3, 2022

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:

assert len(left) % LEN == 2

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants