mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 21:29:24 +01:00
Update Internet.hexip to handle IPv6
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit b0e595fbd2
)
Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
This commit is contained in:
parent
5c9139990b
commit
59936f52f3
@ -149,12 +149,22 @@ class Internet(callbacks.Plugin):
|
|||||||
|
|
||||||
Returns the hexadecimal IP for that IP.
|
Returns the hexadecimal IP for that IP.
|
||||||
"""
|
"""
|
||||||
quads = ip.split('.')
|
|
||||||
ret = ""
|
ret = ""
|
||||||
|
if utils.net.isIPV4(ip):
|
||||||
|
quads = ip.split('.')
|
||||||
for quad in quads:
|
for quad in quads:
|
||||||
i = int(quad)
|
i = int(quad)
|
||||||
ret += '%02x' % i
|
ret += '%02X' % i
|
||||||
irc.reply(ret.upper())
|
else:
|
||||||
|
octets = ip.split(':')
|
||||||
|
for octet in octets:
|
||||||
|
if octet:
|
||||||
|
i = int(octet, 16)
|
||||||
|
ret += '%04X' % i
|
||||||
|
else:
|
||||||
|
missing = (8 - len(octets)) * 4
|
||||||
|
ret += '0' * missing
|
||||||
|
irc.reply(ret)
|
||||||
hexip = wrap(hexip, ['ip'])
|
hexip = wrap(hexip, ['ip'])
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user