__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
from netaddr import (
IPGlob,
IPNetwork,
cidr_to_glob,
glob_to_cidrs,
glob_to_iptuple,
iprange_to_globs,
IPAddress,
valid_glob,
glob_to_iprange,
IPRange,
)
def test_ipglob_basic():
# TODO: do the same testing on IPGlob as IPRange.
assert IPGlob('192.0.2.*') == IPNetwork('192.0.2.0/24')
def test_ipglob_boolean_evaluation():
assert bool(IPGlob('*.*.*.*'))
assert bool(IPGlob('0.0.0.0'))
def test_cidr_to_glob():
assert cidr_to_glob('10.0.0.1/32') == '10.0.0.1'
assert cidr_to_glob('192.0.2.0/24') == '192.0.2.*'
assert cidr_to_glob('172.16.0.0/12') == '172.16-31.*.*'
assert cidr_to_glob('0.0.0.0/0') == '*.*.*.*'
def test_glob_to_cidrs():
assert glob_to_cidrs('10.0.0.1') == [IPNetwork('10.0.0.1/32')]
assert glob_to_cidrs('192.0.2.*') == [IPNetwork('192.0.2.0/24')]
assert glob_to_cidrs('172.16-31.*.*') == [IPNetwork('172.16.0.0/12')]
assert glob_to_cidrs('*.*.*.*') == [IPNetwork('0.0.0.0/0')]
def test_glob_to_iptuple():
assert glob_to_iptuple('*.*.*.*') == (IPAddress('0.0.0.0'), IPAddress('255.255.255.255'))
def test_iprange_to_globs():
assert iprange_to_globs('192.0.2.0', '192.0.2.255') == ['192.0.2.*']
assert iprange_to_globs('192.0.2.1', '192.0.2.15') == ['192.0.2.1-15']
assert iprange_to_globs('192.0.2.255', '192.0.4.1') == [
'192.0.2.255',
'192.0.3.*',
'192.0.4.0-1',
]
assert iprange_to_globs('10.0.1.255', '10.0.255.255') == [
'10.0.1.255',
'10.0.2-3.*',
'10.0.4-7.*',
'10.0.8-15.*',
'10.0.16-31.*',
'10.0.32-63.*',
'10.0.64-127.*',
'10.0.128-255.*',
]
def test_glob_to_iprange():
assert glob_to_iprange('192.0.2.*') == IPRange('192.0.2.0', '192.0.2.255')
assert glob_to_iprange('192.0.2.1-15') == IPRange('192.0.2.1', '192.0.2.15')
assert glob_to_iprange('192.0.1-3.*') == IPRange('192.0.1.0', '192.0.3.255')
def test_invalid_glob():
assert not valid_glob('1.1.1.a')
assert not valid_glob('1.1.1.1/32')
assert not valid_glob('1.1.1.a-b')
assert not valid_glob('1.1.a-b.*')
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| test_cidr_v4.py | File | 7.4 KB | 0644 |
|
| test_cidr_v6.py | File | 4.56 KB | 0644 |
|
| test_dns.py | File | 320 B | 0644 |
|
| test_ip.py | File | 625 B | 0644 |
|
| test_ip_categories.py | File | 4.04 KB | 0644 |
|
| test_ip_comparisons.py | File | 1.39 KB | 0644 |
|
| test_ip_globs.py | File | 2.09 KB | 0644 |
|
| test_ip_network_categories.py | File | 547 B | 0644 |
|
| test_ip_ranges.py | File | 8.57 KB | 0644 |
|
| test_ip_rfc1924.py | File | 512 B | 0644 |
|
| test_ip_sets.py | File | 22.68 KB | 0644 |
|
| test_ip_splitter.py | File | 2.21 KB | 0644 |
|
| test_ip_v4.py | File | 15.07 KB | 0644 |
|
| test_ip_v4_v6_conversions.py | File | 1.22 KB | 0644 |
|
| test_ip_v6.py | File | 5.95 KB | 0644 |
|
| test_network_ops.py | File | 2.37 KB | 0644 |
|
| test_nmap.py | File | 3.62 KB | 0644 |
|
| test_old_specs.py | File | 6.37 KB | 0644 |
|
| test_platform_osx.py | File | 5.29 KB | 0644 |
|
| test_socket_module_fallback.py | File | 1.48 KB | 0644 |
|