mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-06 11:33:41 -05:00
PortLookup: stop parsing notes, the format keeps on changing
(cherry picked from commit 7fd7b98bc37205162e1cc87f55726dcb04e33438)
This commit is contained in:
parent
2ebe1800c6
commit
13224a621a
@ -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 <td> 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))
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user