35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import redis, json, sys
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
r = redis.Redis(host='192.168.110.252', port=6379, password='Jchl1528', db=1, socket_timeout=5)
|
|
keys = r.keys('login_tokens:*')
|
|
print('Login tokens:', len(keys))
|
|
for k in keys[:3]:
|
|
raw = r.get(k)
|
|
if raw:
|
|
s = raw.decode('utf-8', errors='replace')
|
|
print('Key:', k.decode()[:50])
|
|
print('Data (first 500):', s[:500])
|
|
# Check if it's valid JSON
|
|
try:
|
|
obj = json.loads(s)
|
|
print('Type:', type(obj).__name__)
|
|
if isinstance(obj, list):
|
|
print('Array len:', len(obj))
|
|
if len(obj) >= 2:
|
|
print('Element 0:', str(obj[0])[:80])
|
|
print('Element 1 type:', type(obj[1]).__name__)
|
|
elif isinstance(obj, dict):
|
|
print('Keys:', list(obj.keys())[:10])
|
|
except:
|
|
print('NOT valid JSON - first 100 bytes hex:', raw[:100].hex())
|
|
print()
|
|
|
|
# Also check dict cache
|
|
dict_keys = r.keys('sys_dict:*')
|
|
print('Dict keys:', len(dict_keys))
|
|
for k in dict_keys[:2]:
|
|
raw = r.get(k)
|
|
if raw:
|
|
s = raw.decode('utf-8', errors='replace')
|
|
print(' ', k.decode()[:40], '=>', s[:150]) |