From 13224a621a84ce33bb92d0900dc255d1d77f5c90 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 12 Apr 2018 11:07:19 -0700 Subject: [PATCH] PortLookup: stop parsing notes, the format keeps on changing (cherry picked from commit 7fd7b98bc37205162e1cc87f55726dcb04e33438) --- PortLookup/plugin.py | 8 +------- PortLookup/test.py | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/PortLookup/plugin.py b/PortLookup/plugin.py index 770414d..bc5c9d6 100644 --- a/PortLookup/plugin.py +++ b/PortLookup/plugin.py @@ -96,14 +96,8 @@ class PortLookup(callbacks.Plugin): # Remove inline citations (text[1][2][3]), citation needed tags, etc. text = re.sub('\[.*?]', '', text) - # List the port notes (tags such as "Official", "TCP", "UDP", etc.) - # This is every tag except the 4th one, which is the description parsed - # above. - notes = [t.text.strip() for t in tds[:3]+tds[4:] if '?' not in t] - notes = '; '.join(filter(None, notes)) - # Remove \n, etc. in fields to prevent output corruption. - s = utils.str.normalizeWhitespace('%s [%s]' % (ircutils.bold(text), notes)) + s = utils.str.normalizeWhitespace('%s (%s)' % (ircutils.bold(text), portnum)) results.append(s) if results: irc.reply(format('%s: %L', ircutils.bold(ircutils.underline(port)), results)) diff --git a/PortLookup/test.py b/PortLookup/test.py index 637e840..017ee53 100644 --- a/PortLookup/test.py +++ b/PortLookup/test.py @@ -35,7 +35,7 @@ class PortLookupTestCase(PluginTestCase): plugins = ('PortLookup',) def testPort(self): - self.assertRegexp('port 22', 'SSH.*?TCP.*?Official') + self.assertRegexp('port 22', 'SSH') # Some entries in the list are defined as port ranges (i.e. # 6665-6669); we have to split them manually.