[fix] Malicious URL detecting
This commit is contained in:
parent
8f3c67304d
commit
cf75f56f9c
1 changed files with 4 additions and 3 deletions
|
@ -288,11 +288,12 @@ class MessageEventMixin:
|
||||||
|
|
||||||
async def phishing(self, message: Message) -> None:
|
async def phishing(self, message: Message) -> None:
|
||||||
"""Check if the message contains any known phishing domains."""
|
"""Check if the message contains any known phishing domains."""
|
||||||
|
valid = False
|
||||||
for match in url.finditer(message.content):
|
for match in url.finditer(message.content):
|
||||||
if (m := match.group("domain")) in self.phishing_domains:
|
if (m := match.group("domain")) in self.phishing_domains:
|
||||||
pl = await Phishlist.find_one(Phishlist.url == m)
|
pl = await Phishlist.find_one(Phishlist.url == m)
|
||||||
if pl and pl.confirmed and not pl.valid:
|
if pl and pl.confirmed and not pl.valid:
|
||||||
return False
|
continue
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
f"Phishing url `{m}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
f"Phishing url `{m}` detected in {message.guild.id}/{message.channel.id}/{message.id}"
|
||||||
)
|
)
|
||||||
|
@ -353,8 +354,8 @@ class MessageEventMixin:
|
||||||
|
|
||||||
await channel.send(embeds=embed, components=components)
|
await channel.send(embeds=embed, components=components)
|
||||||
|
|
||||||
return True
|
valid = True
|
||||||
return False
|
return valid
|
||||||
|
|
||||||
async def malicious_url(self, message: Message) -> None:
|
async def malicious_url(self, message: Message) -> None:
|
||||||
"""Check if the message contains any known phishing domains."""
|
"""Check if the message contains any known phishing domains."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue