__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
"""Serial Number Arthimetic from RFC 1982"""
class Serial:
def __init__(self, value: int, bits: int = 32):
self.value = value % 2**bits
self.bits = bits
def __repr__(self):
return f"dns.serial.Serial({self.value}, {self.bits})"
def __eq__(self, other):
if isinstance(other, int):
other = Serial(other, self.bits)
elif not isinstance(other, Serial) or other.bits != self.bits:
return NotImplemented
return self.value == other.value
def __ne__(self, other):
if isinstance(other, int):
other = Serial(other, self.bits)
elif not isinstance(other, Serial) or other.bits != self.bits:
return NotImplemented
return self.value != other.value
def __lt__(self, other):
if isinstance(other, int):
other = Serial(other, self.bits)
elif not isinstance(other, Serial) or other.bits != self.bits:
return NotImplemented
if self.value < other.value and other.value - self.value < 2 ** (self.bits - 1):
return True
elif self.value > other.value and self.value - other.value > 2 ** (
self.bits - 1
):
return True
else:
return False
def __le__(self, other):
return self == other or self < other
def __gt__(self, other):
if isinstance(other, int):
other = Serial(other, self.bits)
elif not isinstance(other, Serial) or other.bits != self.bits:
return NotImplemented
if self.value < other.value and other.value - self.value > 2 ** (self.bits - 1):
return True
elif self.value > other.value and self.value - other.value < 2 ** (
self.bits - 1
):
return True
else:
return False
def __ge__(self, other):
return self == other or self > other
def __add__(self, other):
v = self.value
if isinstance(other, Serial):
delta = other.value
elif isinstance(other, int):
delta = other
else:
raise ValueError
if abs(delta) > (2 ** (self.bits - 1) - 1):
raise ValueError
v += delta
v = v % 2**self.bits
return Serial(v, self.bits)
def __iadd__(self, other):
v = self.value
if isinstance(other, Serial):
delta = other.value
elif isinstance(other, int):
delta = other
else:
raise ValueError
if abs(delta) > (2 ** (self.bits - 1) - 1):
raise ValueError
v += delta
v = v % 2**self.bits
self.value = v
return self
def __sub__(self, other):
v = self.value
if isinstance(other, Serial):
delta = other.value
elif isinstance(other, int):
delta = other
else:
raise ValueError
if abs(delta) > (2 ** (self.bits - 1) - 1):
raise ValueError
v -= delta
v = v % 2**self.bits
return Serial(v, self.bits)
def __isub__(self, other):
v = self.value
if isinstance(other, Serial):
delta = other.value
elif isinstance(other, int):
delta = other
else:
raise ValueError
if abs(delta) > (2 ** (self.bits - 1) - 1):
raise ValueError
v -= delta
v = v % 2**self.bits
self.value = v
return self
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| quic | Folder | 0755 |
|
|
| rdtypes | Folder | 0755 |
|
|
| __init__.py | File | 1.61 KB | 0644 |
|
| _asyncbackend.py | File | 1.96 KB | 0644 |
|
| _asyncio_backend.py | File | 5.03 KB | 0644 |
|
| _curio_backend.py | File | 3.48 KB | 0644 |
|
| _immutable_ctx.py | File | 2.4 KB | 0644 |
|
| _trio_backend.py | File | 3.83 KB | 0644 |
|
| asyncbackend.py | File | 2.88 KB | 0644 |
|
| asyncquery.py | File | 24.68 KB | 0644 |
|
| asyncresolver.py | File | 10.24 KB | 0644 |
|
| dnssec.py | File | 42.17 KB | 0644 |
|
| dnssectypes.py | File | 1.76 KB | 0644 |
|
| e164.py | File | 3.88 KB | 0644 |
|
| edns.py | File | 13.69 KB | 0644 |
|
| entropy.py | File | 4.14 KB | 0644 |
|
| enum.py | File | 3.17 KB | 0644 |
|
| exception.py | File | 5.45 KB | 0644 |
|
| flags.py | File | 2.69 KB | 0644 |
|
| grange.py | File | 2.1 KB | 0644 |
|
| immutable.py | File | 1.79 KB | 0644 |
|
| inet.py | File | 4.9 KB | 0644 |
|
| ipv4.py | File | 2.02 KB | 0644 |
|
| ipv6.py | File | 6.05 KB | 0644 |
|
| message.py | File | 60.38 KB | 0644 |
|
| name.py | File | 33.62 KB | 0644 |
|
| namedict.py | File | 3.91 KB | 0644 |
|
| node.py | File | 12.37 KB | 0644 |
|
| opcode.py | File | 2.67 KB | 0644 |
|
| py.typed | File | 0 B | 0644 |
|
| query.py | File | 48.02 KB | 0644 |
|
| rcode.py | File | 4.06 KB | 0644 |
|
| rdata.py | File | 29.07 KB | 0644 |
|
| rdataclass.py | File | 2.91 KB | 0644 |
|
| rdataset.py | File | 16.67 KB | 0644 |
|
| rdatatype.py | File | 7.17 KB | 0644 |
|
| renderer.py | File | 10.42 KB | 0644 |
|
| resolver.py | File | 61.92 KB | 0644 |
|
| reversename.py | File | 3.74 KB | 0644 |
|
| rrset.py | File | 8.97 KB | 0644 |
|
| serial.py | File | 3.52 KB | 0644 |
|
| set.py | File | 8.88 KB | 0644 |
|
| tokenizer.py | File | 23.03 KB | 0644 |
|
| transaction.py | File | 21.12 KB | 0644 |
|
| tsig.py | File | 11.19 KB | 0644 |
|
| tsigkeyring.py | File | 2.58 KB | 0644 |
|
| ttl.py | File | 2.91 KB | 0644 |
|
| update.py | File | 11.96 KB | 0644 |
|
| version.py | File | 1.88 KB | 0644 |
|
| versioned.py | File | 11.5 KB | 0644 |
|
| win32util.py | File | 8.84 KB | 0644 |
|
| wire.py | File | 2.76 KB | 0644 |
|
| xfr.py | File | 12.96 KB | 0644 |
|
| zone.py | File | 49.86 KB | 0644 |
|
| zonefile.py | File | 26.84 KB | 0644 |
|
| zonetypes.py | File | 690 B | 0644 |
|