__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# -----------------------------------------------------------------------------
# Copyright (c) 2008 by David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
# -----------------------------------------------------------------------------
"""A basic implementation of RFC 1924 ;-)"""
from netaddr.core import AddrFormatError
from netaddr.ip import IPAddress
def chr_range(low, high):
"""Returns all characters between low and high chars."""
return [chr(i) for i in range(ord(low), ord(high) + 1)]
#: Base 85 integer index to character lookup table.
BASE_85 = (
chr_range('0', '9')
+ chr_range('A', 'Z')
+ chr_range('a', 'z')
+ [
'!',
'#',
'$',
'%',
'&',
'(',
')',
'*',
'+',
'-',
';',
'<',
'=',
'>',
'?',
'@',
'^',
'_',
'`',
'{',
'|',
'}',
'~',
]
)
#: Base 85 digit to integer lookup table.
BASE_85_DICT = dict(zip(BASE_85, range(0, 86)))
def ipv6_to_base85(addr):
"""Convert a regular IPv6 address to base 85."""
ip = IPAddress(addr)
int_val = int(ip)
remainder = []
while int_val > 0:
remainder.append(int_val % 85)
int_val //= 85
encoded = ''.join([BASE_85[w] for w in reversed(remainder)])
leading_zeroes = (20 - len(encoded)) * '0'
return leading_zeroes + encoded
def base85_to_ipv6(addr):
"""
Convert a base 85 IPv6 address to its hexadecimal format.
"""
tokens = list(addr)
if len(tokens) != 20:
raise AddrFormatError('Invalid base 85 IPv6 address: %r' % (addr,))
result = 0
for i, num in enumerate(reversed(tokens)):
num = BASE_85_DICT[num]
result += num * 85**i
ip = IPAddress(result, 6)
return str(ip)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 69.67 KB | 0644 |
|
| glob.py | File | 10.15 KB | 0644 |
|
| iana.py | File | 13.62 KB | 0644 |
|
| ipv4-address-space.xml | File | 74.54 KB | 0644 |
|
| ipv6-address-space.xml | File | 9.42 KB | 0644 |
|
| ipv6-unicast-address-assignments.xml | File | 14.54 KB | 0644 |
|
| multicast-addresses.xml | File | 171.01 KB | 0644 |
|
| nmap.py | File | 3.92 KB | 0644 |
|
| rfc1924.py | File | 1.86 KB | 0644 |
|
| sets.py | File | 25.75 KB | 0644 |
|