mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Added skullY's patches for Network.whois for .orgs.
This commit is contained in:
parent
6be8850822
commit
976efd87cf
@ -71,21 +71,55 @@ class Network(callbacks.Privmsg):
|
|||||||
except socket.error:
|
except socket.error:
|
||||||
irc.reply('Host not found.')
|
irc.reply('Host not found.')
|
||||||
|
|
||||||
_tlds = sets.Set(['com', 'net', 'edu'])
|
_tlds = sets.Set(['com', 'net', 'edu', 'org'])
|
||||||
def whois(self, irc, msg, args):
|
def whois(self, irc, msg, args):
|
||||||
"""<domain>
|
"""<domain>
|
||||||
|
|
||||||
Returns WHOIS information on the registration of <domain>. <domain>
|
Returns WHOIS information on the registration of <domain>. <domain>
|
||||||
must be in tlds .com, .net, or .edu.
|
must be in tlds .com, .net, .edu, or .org.
|
||||||
"""
|
"""
|
||||||
domain = privmsgs.getArgs(args)
|
domain = privmsgs.getArgs(args)
|
||||||
if '.' not in domain or domain.split('.')[-1] not in self._tlds:
|
usertld = domain.split('.')[-1]
|
||||||
irc.error('<domain> must be in .com, .net, or .edu.')
|
if '.' not in domain or usertld not in self._tlds:
|
||||||
|
irc.error('<domain> must be in .com, .net, .edu, or .org.')
|
||||||
return
|
return
|
||||||
elif len(domain.split('.')) != 2:
|
elif len(domain.split('.')) != 2:
|
||||||
irc.error('<domain> must be a domain, not a hostname.')
|
irc.error('<domain> must be a domain, not a hostname.')
|
||||||
return
|
return
|
||||||
t = telnetlib.Telnet('rs.internic.net', 43)
|
if usertld == 'org':
|
||||||
|
t = telnetlib.Telnet('whois.pir.org', 43)
|
||||||
|
t.write(domain)
|
||||||
|
t.write('\n')
|
||||||
|
s = t.read_all()
|
||||||
|
for line in s.splitlines():
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
if line.startswith('Sponsoring Registrar'):
|
||||||
|
registar = ':'.join(line.split(':')[1:])
|
||||||
|
elif line.startswith('Last Updated On'):
|
||||||
|
updated = ':'.join(line.split(':')[1:])
|
||||||
|
elif line.startswith('Created On'):
|
||||||
|
created = ':'.join(line.split(':')[1:])
|
||||||
|
elif line.startswith('Expiration Date'):
|
||||||
|
expires = ':'.join(line.split(':')[1:])
|
||||||
|
elif line.startswith('Status'):
|
||||||
|
status = ':'.join(line.split(':')[1:]).lower()
|
||||||
|
t = telnetlib.Telnet('whois.pir.org', 43)
|
||||||
|
t.write('registrar id ')
|
||||||
|
t.write(registar)
|
||||||
|
t.write('\n')
|
||||||
|
s = t.read_all()
|
||||||
|
for line in s.splitlines():
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
if line.startswith('Email'):
|
||||||
|
url = 'registered at '
|
||||||
|
url += line.split('@')[-1]
|
||||||
|
else:
|
||||||
|
t = telnetlib.Telnet('rs.internic.net', 43)
|
||||||
|
t.write('=')
|
||||||
t.write(domain)
|
t.write(domain)
|
||||||
t.write('\n')
|
t.write('\n')
|
||||||
s = t.read_all()
|
s = t.read_all()
|
||||||
@ -93,8 +127,6 @@ class Network(callbacks.Privmsg):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
if line.startswith('Registrar'):
|
|
||||||
registrar = line.split()[-1].capitalize()
|
|
||||||
elif line.startswith('Referral'):
|
elif line.startswith('Referral'):
|
||||||
url = line.split()[-1]
|
url = line.split()[-1]
|
||||||
elif line.startswith('Updated'):
|
elif line.startswith('Updated'):
|
||||||
|
@ -42,7 +42,9 @@ if network:
|
|||||||
def testWhois(self):
|
def testWhois(self):
|
||||||
self.assertNotError('network whois ohio-state.edu')
|
self.assertNotError('network whois ohio-state.edu')
|
||||||
self.assertError('network whois www.ohio-state.edu')
|
self.assertError('network whois www.ohio-state.edu')
|
||||||
self.assertError('network whois slashdot.org')
|
self.assertNotError('network whois kuro5hin.org')
|
||||||
|
self.assertError('network whois www.kuro5hin.org')
|
||||||
|
self.assertNotError('network whois microsoft.com')
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user