Skip to content

Commit

Permalink
search results can be single IP or network, adapt!
Browse files Browse the repository at this point in the history
Humbedooh committed Mar 10, 2019
1 parent ee1a4b7 commit fd058b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/api/pages/search.py
Original file line number Diff line number Diff line change
@@ -59,9 +59,12 @@
def find_rule(DB, doctype, ip):
""" Find a rule, either v1 or v2 style """
bid = plugins.worker.make_sha1(str(ip))
bid2 = plugins.worker.make_sha1(str(ip).replace('/32', '').replace('/128',''))
# Blocky/2 ban doc
if DB.ES.exists(index=DB.dbname, doc_type = doctype, id = bid):
return DB.ES.get(index=DB.dbname, doc_type = doctype, id = bid)
if DB.ES.exists(index=DB.dbname, doc_type = doctype, id = bid2):
return DB.ES.get(index=DB.dbname, doc_type = doctype, id = bid2)

# Blocky/1 ban doc
oid = str(ip).replace('/', '_').replace('_32', '').replace('_128', '')

0 comments on commit fd058b1

Please sign in to comment.