mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Internet: Use whois-servers.net for all whois lookups.
rs.internic.net seems to be broken and using $tld.whois-servers.net looks to
be working for everything.
Also need to update the line termination string to use '\r\n' instead of '\n'
since some servers are strict about receiving the former.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 397cbbe0d3
)
This commit is contained in:
parent
8d94ff743c
commit
be9128b3ec
@ -1,5 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2003-2005, Jeremiah Fincher
|
# Copyright (c) 2003-2005, Jeremiah Fincher
|
||||||
|
# Copyright (c) 2010, James Vega
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -61,7 +62,6 @@ class Internet(callbacks.Plugin):
|
|||||||
irc.reply('Host not found.')
|
irc.reply('Host not found.')
|
||||||
dns = wrap(dns, ['something'])
|
dns = wrap(dns, ['something'])
|
||||||
|
|
||||||
_tlds = set(['com', 'net', 'edu'])
|
|
||||||
_domain = ['Domain Name', 'Server Name', 'domain']
|
_domain = ['Domain Name', 'Server Name', 'domain']
|
||||||
_registrar = ['Sponsoring Registrar', 'Registrar', 'source']
|
_registrar = ['Sponsoring Registrar', 'Registrar', 'source']
|
||||||
_updated = ['Last Updated On', 'Domain Last Updated Date', 'Updated Date',
|
_updated = ['Last Updated On', 'Domain Last Updated Date', 'Updated Date',
|
||||||
@ -76,24 +76,15 @@ class Internet(callbacks.Plugin):
|
|||||||
"""
|
"""
|
||||||
usertld = domain.split('.')[-1]
|
usertld = domain.split('.')[-1]
|
||||||
if '.' not in domain:
|
if '.' not in domain:
|
||||||
irc.error('<domain> must be in .com, .net, .edu, or .org.')
|
irc.errorInvalid('domain')
|
||||||
return
|
return
|
||||||
elif len(domain.split('.')) != 2:
|
|
||||||
irc.error('<domain> must be a domain, not a hostname.')
|
|
||||||
return
|
|
||||||
if usertld in self._tlds:
|
|
||||||
server = 'rs.internic.net'
|
|
||||||
search = '=%s' % domain
|
|
||||||
else:
|
|
||||||
server = '%s.whois-servers.net' % usertld
|
|
||||||
search = domain
|
|
||||||
try:
|
try:
|
||||||
t = telnetlib.Telnet(server, 43)
|
t = telnetlib.Telnet('%s.whois-servers.net' % usertld, 43)
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
irc.error(str(e))
|
irc.error(str(e))
|
||||||
return
|
return
|
||||||
t.write(search)
|
t.write(domain)
|
||||||
t.write('\n')
|
t.write('\r\n')
|
||||||
s = t.read_all()
|
s = t.read_all()
|
||||||
server = registrar = updated = created = expires = status = ''
|
server = registrar = updated = created = expires = status = ''
|
||||||
for line in s.splitlines():
|
for line in s.splitlines():
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2003-2005, Jeremiah Fincher
|
# Copyright (c) 2003-2005, Jeremiah Fincher
|
||||||
|
# Copyright (c) 2010, James Vega
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -39,11 +40,10 @@ class InternetTestCase(PluginTestCase):
|
|||||||
|
|
||||||
def testWhois(self):
|
def testWhois(self):
|
||||||
self.assertNotError('internet whois ohio-state.edu')
|
self.assertNotError('internet whois ohio-state.edu')
|
||||||
self.assertError('internet whois www.ohio-state.edu')
|
|
||||||
self.assertNotError('internet whois kuro5hin.org')
|
self.assertNotError('internet whois kuro5hin.org')
|
||||||
self.assertError('internet whois www.kuro5hin.org')
|
|
||||||
self.assertNotError('internet whois microsoft.com')
|
self.assertNotError('internet whois microsoft.com')
|
||||||
self.assertNotError('internet whois inria.fr')
|
self.assertNotError('internet whois inria.fr')
|
||||||
|
self.assertNotError('internet whois slime.com.au')
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
Reference in New Issue
Block a user