22 lines
571 B
Python
22 lines
571 B
Python
|
#! /usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
"""
|
||
|
Some functions for making web interactions easier.
|
||
|
"""
|
||
|
import requests, os
|
||
|
from urllib.parse import urlparse
|
||
|
|
||
|
def secCheck(bot, url):
|
||
|
""" Checks to see if the given link is malicious or not. """
|
||
|
if not urlparse(url).scheme:
|
||
|
hostname = urlparse("//"+url).hostname
|
||
|
else:
|
||
|
hostname = urlparse(url).hostname
|
||
|
|
||
|
# Since bot.memory['safety_cache'] apparently doesn't work.
|
||
|
with open(os.path.join(bot.config.homedir, 'malwaredomains.txt'), 'r') as file:
|
||
|
if hostname in file.read().split():
|
||
|
return None
|
||
|
|
||
|
return url
|