diff options
| author | 2018-10-03 13:22:37 +0100 | |
|---|---|---|
| committer | 2018-10-03 13:22:37 +0100 | |
| commit | 69d58eede2e9bf83aa1ed1d8fcf956efde494726 (patch) | |
| tree | 11aa30f2a357f3be23ad97315dae3df051455cbe /modules/check_urls.py | |
| parent | Add a way to not add a user automatically in IRCServer.get_user (diff) | |
| signature | ||
Move src/Utils.py in to src/utils/, splitting functionality out in to modules of
related functionality
Diffstat (limited to 'modules/check_urls.py')
| -rw-r--r-- | modules/check_urls.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/check_urls.py b/modules/check_urls.py index 356fc13b..f63ac902 100644 --- a/modules/check_urls.py +++ b/modules/check_urls.py @@ -1,28 +1,28 @@ #--require-config virustotal-api-key import re -from src import ModuleManager, Utils +from src import ModuleManager, utils URL_VIRUSTOTAL = "https://www.virustotal.com/vtapi/v2/url/report" RE_URL = re.compile(r"https?://\S+", re.I) -@Utils.export("channelset", {"setting": "check-urls", +@utils.export("channelset", {"setting": "check-urls", "help": "Enable/Disable automatically checking for malicious URLs", - "validate": Utils.bool_or_none}) -@Utils.export("serverset", {"setting": "check-urls", + "validate": utils.bool_or_none}) +@utils.export("serverset", {"setting": "check-urls", "help": "Enable/Disable automatically checking for malicious URLs", - "validate": Utils.bool_or_none}) -@Utils.export("channelset", {"setting": "check-urls-kick", + "validate": utils.bool_or_none}) +@utils.export("channelset", {"setting": "check-urls-kick", "help": "Enable/Disable automatically kicking users that " - "send malicious URLs", "validate": Utils.bool_or_none}) + "send malicious URLs", "validate": utils.bool_or_none}) class Module(ModuleManager.BaseModule): - @Utils.hook("received.message.channel") + @utils.hook("received.message.channel") def message(self, event): match = RE_URL.search(event["message"]) if match and event["channel"].get_setting("check-urls", event["server"].get_setting("check-urls", False)): url = match.group(0) - page = Utils.get_url(URL_VIRUSTOTAL, get_params={ + page = utils.http.get_url(URL_VIRUSTOTAL, get_params={ "apikey": self.bot.config["virustotal-api-key"], "resource": url}, json=True) |
