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

how read binary key from file that is exported by -e print ? #108

Open
linux2014linux opened this issue Dec 18, 2017 · 3 comments
Open

how read binary key from file that is exported by -e print ? #108

linux2014linux opened this issue Dec 18, 2017 · 3 comments

Comments

@linux2014linux
Copy link

linux2014linux commented Dec 18, 2017

I exported some result to file by '-e print'. I want to read key in file to get redis content. But I found some binary key, example:

binary_key: \x0A\x0E\x08\x8A\xBC\xE2\xCB\x05\x10\x16\x18\x0E(\x058\x02

I try parse binary_key by decode('hex), but happen some error follow info:

TypeError: Odd-length string

How do I solve the problem?

@linux2014linux linux2014linux changed the title how -e print binary key? how read binary key from file that is exported by -e print ? Dec 18, 2017
@oranagra
Copy link
Collaborator

only the non-printable chars are converted to hex.
look at escape_ascii_bytes in rdbtools/encodehelpers.py

so yo can that this sequence can be fed directly to python as a literal.
print("\x28 - (")
( - (

@oranagra
Copy link
Collaborator

I think in python 2 you should use decode('string_escape')

@wudanyang6
Copy link

do this: -e base64

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

3 participants