From 74909f496f396efee846827879738b116e96d0dc Mon Sep 17 00:00:00 2001 From: urlbot Date: Mon, 1 Dec 2014 17:50:24 +0100 Subject: [PATCH] add parse_cve: print sec-tr.d.o links --- plugins.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins.py b/plugins.py index bf7ed31..a66f453 100644 --- a/plugins.py +++ b/plugins.py @@ -88,6 +88,23 @@ def parse_debbug(args): 'msg': title } +def parse_cve(args): + if 'register' == args: + return { + 'name': 'parse a CVE handle', + 'args': ('data',), + 'ratelimit_class': RATE_NO_SILENCE | RATE_GLOBAL + } + + cves = re.findall(r'(CVE-\d\d\d\d-\d+)', args['data'].upper()) + if not cves: + return None + + logger('plugin', 'detected CVE handle') + return { + 'msg': 'https://security-tracker.debian.org/tracker/%s' % cves[0] + } + def parse_skynet(args): if 'register' == args: return { @@ -537,7 +554,7 @@ def data_parse_commands(data): chat_write(ret['msg']) funcs = {} -funcs['parse'] = (parse_mental_ill, parse_skynet, parse_debbug) +funcs['parse'] = (parse_mental_ill, parse_skynet, parse_debbug, parse_cve) funcs['command'] = ( command_command, command_help, command_version, command_unicode, command_klammer, command_source, command_dice, command_uptime, command_ping,