Obscured domain guessing for reasons field

This commit is contained in:
Mint 2022-10-03 19:50:28 +03:00
parent 8f06382138
commit cd7e83f0f7

View file

@ -253,6 +253,16 @@ for blocker, software in c.fetchall():
).items(): ).items():
for blocked, reason in info.items(): for blocked, reason in info.items():
blocked = tidyup(blocked) blocked = tidyup(blocked)
if blocked == "":
continue
if blocked.count("*") > 1:
# same domain guess as above, but for reasons field
c.execute(
"select domain from instances where domain like ? order by rowid limit 1", (blocked.replace("*", "_"),)
)
searchres = c.fetchone()
if searchres != None:
blocked = searchres[0]
c.execute( c.execute(
"update blocks set reason = ? where blocker = ? and blocked = ? and block_level = ?", "update blocks set reason = ? where blocker = ? and blocked = ? and block_level = ?",
(reason["reason"], blocker, blocked, block_level), (reason["reason"], blocker, blocked, block_level),