redis-rdb-tools
redis-rdb-tools copied to clipboard
how read binary key from file that is exported by -e print ?
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?
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 - (") ( - (
I think in python 2 you should use decode('string_escape')
do this: -e base64