chg: [api] md5 lookup updated to allow MD5 only records

This commit is contained in:
Alexandre Dulaunoy 2021-09-01 19:26:58 +02:00
parent c17dbff6a6
commit bb29fcb25c
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -100,6 +100,9 @@ class lookup(Resource):
session_key = "session:{}:exist".format(request.headers.get('hashlookup_session'))
rdb.sadd(session_key, k)
rdb.expire(session_key, ttl)
if rdb.exist("h:{}".format(k)):
h = db.hgetall("h:{}".format(k))
else:
sha1 = rdb.get("l:{}".format(k))
h = rdb.hgetall("h:{}".format(sha1))
if "OpSystemCode" in h: