mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 04:51:08 -05:00
PortLookup: drop, broken and unmaintainable
This commit is contained in:
parent
1aacd7c2a1
commit
d28233138f
@ -1,8 +0,0 @@
|
|||||||
Looks up commonly used UDP and TCP port numbers from Wikipedia: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
|
|
||||||
|
|
||||||
```
|
|
||||||
<GLolol> `port 22
|
|
||||||
<Atlas> 22: Secure Shell (SSH), secure logins, file transfers (scp, sftp) and port forwarding [22; TCP SCTP; UDP; Official]
|
|
||||||
<GLolol> `port 7000
|
|
||||||
<Atlas> 7000: QuickTime Streaming Server [6970–9999; UDP; Unofficial], Default for Vuze's built in HTTPS Bittorrent Tracker [7000; TCP; Unofficial], and Avira Server Management Console [7000; TCP; Unofficial]
|
|
||||||
```
|
|
@ -1,69 +0,0 @@
|
|||||||
###
|
|
||||||
# Copyright (c) 2014-2015, James Lu
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the author of this software nor the name of
|
|
||||||
# contributors to this software may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written consent.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
"""
|
|
||||||
Looks up commonly used TCP and UDP port numbers.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import supybot
|
|
||||||
import supybot.world as world
|
|
||||||
|
|
||||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
|
||||||
# in here if you're keeping the plugin in CVS or some similar system.
|
|
||||||
__version__ = "2017.05.31"
|
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
|
||||||
__author__ = supybot.Author('James Lu', 'GLolol',
|
|
||||||
'GLolol@overdrivenetworks.com')
|
|
||||||
|
|
||||||
# This is a dictionary mapping supybot.Author instances to lists of
|
|
||||||
# contributions.
|
|
||||||
__contributors__ = {}
|
|
||||||
|
|
||||||
# This is a url where the most recent plugin package can be downloaded.
|
|
||||||
__url__ = 'https://github.com/GLolol/SupyPlugins/'
|
|
||||||
|
|
||||||
from . import config
|
|
||||||
from . import plugin
|
|
||||||
from imp import reload
|
|
||||||
# In case we're being reloaded.
|
|
||||||
reload(config)
|
|
||||||
reload(plugin)
|
|
||||||
# Add more reloads here if you add third-party modules and want them to be
|
|
||||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
|
||||||
|
|
||||||
if world.testing:
|
|
||||||
from . import test
|
|
||||||
|
|
||||||
Class = plugin.Class
|
|
||||||
configure = config.configure
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
|
@ -1,51 +0,0 @@
|
|||||||
###
|
|
||||||
# Copyright (c) 2014-2015, James Lu
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the author of this software nor the name of
|
|
||||||
# contributors to this software may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written consent.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.registry as registry
|
|
||||||
try:
|
|
||||||
from supybot.i18n import PluginInternationalization
|
|
||||||
_ = PluginInternationalization('PortLookup')
|
|
||||||
except:
|
|
||||||
# Placeholder that allows to run the plugin on a bot
|
|
||||||
# without the i18n module
|
|
||||||
_ = lambda x:x
|
|
||||||
|
|
||||||
def configure(advanced):
|
|
||||||
# This will be called by supybot to configure this module. advanced is
|
|
||||||
# a bool that specifies whether the user identified himself as an advanced
|
|
||||||
# user or not. You should effect your configuration by manipulating the
|
|
||||||
# registry as appropriate.
|
|
||||||
from supybot.questions import expect, anything, something, yn
|
|
||||||
conf.registerPlugin('PortLookup', True)
|
|
||||||
|
|
||||||
PortLookup = conf.registerPlugin('PortLookup')
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
|
@ -1 +0,0 @@
|
|||||||
# Stub so local is a module, used for third-party modules
|
|
@ -1,108 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
###
|
|
||||||
# Copyright (c) 2014-2015, James Lu
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the author of this software nor the name of
|
|
||||||
# contributors to this software may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written consent.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
###
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import re
|
|
||||||
try:
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
except ImportError:
|
|
||||||
raise ImportError("Beautiful Soup 4 is required for this plugin: "
|
|
||||||
"http://www.crummy.com/software/BeautifulSoup/bs4/"
|
|
||||||
"doc/#installing-beautiful-soup")
|
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.utils as utils
|
|
||||||
from supybot.commands import *
|
|
||||||
import supybot.plugins as plugins
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.callbacks as callbacks
|
|
||||||
import supybot.world as world
|
|
||||||
try:
|
|
||||||
from supybot.i18n import PluginInternationalization
|
|
||||||
_ = PluginInternationalization('PortLookup')
|
|
||||||
except ImportError:
|
|
||||||
# Placeholder that allows to run the plugin on a bot
|
|
||||||
# without the i18n module
|
|
||||||
_ = lambda x:x
|
|
||||||
|
|
||||||
class PortLookup(callbacks.Plugin):
|
|
||||||
"""Looks up commonly used TCP and UDP port numbers."""
|
|
||||||
@wrap(['positiveInt'])
|
|
||||||
def port(self, irc, msg, args, port):
|
|
||||||
"""<port number>
|
|
||||||
|
|
||||||
Looks up <port number> in Wikipedia's list of ports at
|
|
||||||
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers.
|
|
||||||
"""
|
|
||||||
if port > 65535:
|
|
||||||
irc.error('Port numbers cannot be greater than 65535.', Raise=True)
|
|
||||||
if BeautifulSoup is None:
|
|
||||||
irc.error("Beautiful Soup 4 is required for this plugin: get it"
|
|
||||||
" at http://www.crummy.com/software/BeautifulSoup/bs4/"
|
|
||||||
"doc/#installing-beautiful-soup", Raise=True)
|
|
||||||
url = "https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers"
|
|
||||||
fd = utils.web.getUrlFd(url)
|
|
||||||
soup = BeautifulSoup(fd)
|
|
||||||
if port >= 49152:
|
|
||||||
results = ['The range 49152–65535 (2^15+2^14 to 2^16−1)—above the '
|
|
||||||
'registered ports—contains dynamic or private ports that '
|
|
||||||
'cannot be registered with IANA. This range is used for '
|
|
||||||
'custom or temporary purposes and for automatic '
|
|
||||||
'allocation of ephemeral ports.']
|
|
||||||
else:
|
|
||||||
results = []
|
|
||||||
for tr in soup.find_all('tr'):
|
|
||||||
tds = tr.find_all('td')
|
|
||||||
if not tds:
|
|
||||||
continue
|
|
||||||
portnum = tds[0].text
|
|
||||||
if '–' in portnum:
|
|
||||||
startport, endport = map(int, portnum.split('–'))
|
|
||||||
p = range(startport, endport+1)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
p = [int(portnum)]
|
|
||||||
except ValueError:
|
|
||||||
continue
|
|
||||||
if port in p:
|
|
||||||
text = tds[3].text
|
|
||||||
# Remove inline citations (text[1][2][3]), citation needed tags, etc.
|
|
||||||
text = re.sub('\[.*?]', '', text)
|
|
||||||
|
|
||||||
# Remove \n, etc. in fields to prevent output corruption.
|
|
||||||
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))
|
|
||||||
else:
|
|
||||||
irc.error(_('No results found.'))
|
|
||||||
Class = PortLookup
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
|
@ -1,50 +0,0 @@
|
|||||||
###
|
|
||||||
# Copyright (c) 2014-2015, James Lu
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
# this list of conditions, and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the author of this software nor the name of
|
|
||||||
# contributors to this software may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written consent.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
from sys import version_info
|
|
||||||
from supybot.test import *
|
|
||||||
|
|
||||||
class PortLookupTestCase(PluginTestCase):
|
|
||||||
plugins = ('PortLookup',)
|
|
||||||
|
|
||||||
def testPort(self):
|
|
||||||
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.
|
|
||||||
self.assertRegexp('port 6667', 'Internet Relay Chat')
|
|
||||||
|
|
||||||
self.assertError('port 77777') # Port numbers can't be >65535
|
|
||||||
|
|
||||||
# Wikipedia notes that ports 49152-65535 cannot be registered
|
|
||||||
# with IANA, so we'll leave a note here too.
|
|
||||||
self.assertRegexp('port 65300', 'cannot be registered')
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
|
@ -70,10 +70,6 @@ Most of these plugins also have their own READMEs in their folders; you can usua
|
|||||||
- Fetches package information from various Linux and BSD distros' software repositories.
|
- Fetches package information from various Linux and BSD distros' software repositories.
|
||||||
- **Requires:** [Beautiful Soup 4](http://www.crummy.com/software/BeautifulSoup/bs4/doc/)
|
- **Requires:** [Beautiful Soup 4](http://www.crummy.com/software/BeautifulSoup/bs4/doc/)
|
||||||
|
|
||||||
##### PortLookup
|
|
||||||
- Looks up commonly used UDP and TCP port numbers from Wikipedia: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
|
|
||||||
- **Requires:** [Beautiful Soup 4](http://www.crummy.com/software/BeautifulSoup/bs4/doc/)
|
|
||||||
|
|
||||||
##### QuakeNet
|
##### QuakeNet
|
||||||
- Log in to Quakenet's Q Service via CHALLENGEAUTH. This plugin was written by request and not officially supported.
|
- Log in to Quakenet's Q Service via CHALLENGEAUTH. This plugin was written by request and not officially supported.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user