diff --git a/dev/scripts/autoFixer.py b/dev/scripts/autoFixer.py new file mode 100644 index 0000000000000000000000000000000000000000..efb54c7584c8dec22b5fe9192b72246642c04d62 --- /dev/null +++ b/dev/scripts/autoFixer.py @@ -0,0 +1,65 @@ +#! /usr/bin/env python + +"Process python files to improve python 3 migration" + +import os +import sys +import getopt +# Modified glob version to support ** +import glob2 +import re + +def main(): + tabsize = 8 + try: + opts, args = getopt.getopt(sys.argv[1:], "t:") + if not args: + raise getopt.error, "At least one file argument required" + except getopt.error, msg: + print msg + print "usage:", sys.argv[0], "files ..." + return + + files = [] + for arg in args: + files.extend(glob2.glob(arg)) + + for filename in files: + if "autoFixer" in filename or "build" in filename: + continue + process(filename, tabsize) + +# Utils, regexes +r1_ = r'([( ,=])(?<![b])\"(([^\n\\\"]|\\.)*(\\x|\\0)([^\n\\\"]|\\.)*)\"' +r2_ = r"([( ,=])(?<![b])\'(([^\n\\\']|\\.)*(\\x|\\0)([^\n\\\']|\\.)*)\'" +#r3_ = r"(?<![\"'\\])(['\"])\1([^\"'])" + +r1_r = r'\g<1>b"\2"' +r2_r = r"\g<1>b'\2'" +#r3_r = r"b\1\1\2" + +def process(filename, tabsize): + try: + f = open(filename) + text = f.read() + f.close() + except IOError, msg: + print "%r: I/O error: %s" % (filename, msg) + return + # Remove tabs + newtext = text.expandtabs(tabsize) + # Auto-detect bytes with "\x...", "\0..." + newtext = re.sub(r1_, r1_r, newtext) + # Auto-detect bytes with '\x...', '\0...' + newtext = re.sub(r2_, r2_r, newtext) + # Auto-detect bytes with '', "" but not """, ''' + #newtext = re.sub(r3_, r3_r, newtext) + if newtext == text: + return + f = open(filename, "w") + f.write(newtext) + f.close() + print filename + +if __name__ == '__main__': + main() diff --git a/scapy/arch/bpf/core.py b/scapy/arch/bpf/core.py index c02b744e1b8edcdf3a9d73e9b8f752c06a1a92a5..e862810cbeaf6a53463cdf575caf5124afc27a85 100644 --- a/scapy/arch/bpf/core.py +++ b/scapy/arch/bpf/core.py @@ -53,13 +53,13 @@ def get_if_raw_addr(ifname): fd = os.popen("%s %s" % (conf.prog.ifconfig, ifname)) except OSError, msg: warning("Failed to execute ifconfig: (%s)" % msg) - return "\0\0\0\0" + return b"\0\0\0\0" # Get IPv4 addresses addresses = [l for l in fd if l.find("netmask") >= 0] if not addresses: warning("No IPv4 address found on %s !" % ifname) - return "\0\0\0\0" + return b"\0\0\0\0" # Pack the first address address = addresses[0].split(' ')[1] @@ -69,7 +69,7 @@ def get_if_raw_addr(ifname): def get_if_raw_hwaddr(ifname): """Returns the packed MAC address configured on 'ifname'.""" - NULL_MAC_ADDRESS = '\x00'*6 + NULL_MAC_ADDRESS = b'\x00'*6 # Handle the loopback interface separately if ifname == LOOPBACK_NAME: diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py index 9fe78381b0e5a792691ba2209ac2700a6cc82c6f..614adbde84fe3280dcd667c046a3a0ea0c42de33 100644 --- a/scapy/arch/linux.py +++ b/scapy/arch/linux.py @@ -97,7 +97,7 @@ def get_if_raw_addr(iff): try: return get_if(iff, SIOCGIFADDR)[20:24] except IOError: - return "\0\0\0\0" + return b"\0\0\0\0" def get_if_list(): @@ -400,7 +400,7 @@ class L3PacketSocket(SuperSocket): self.outs.sendto(sx, sdto) except socket.error, msg: if msg[0] == 22 and len(sx) < conf.min_pkt_size: - self.outs.send(sx + "\x00" * (conf.min_pkt_size - len(sx))) + self.outs.send(sx + b"\x00" * (conf.min_pkt_size - len(sx))) elif conf.auto_fragment and msg[0] == 90: for p in x.fragment(): self.outs.sendto(str(ll(p)), sdto) @@ -465,7 +465,7 @@ class L2Socket(SuperSocket): return SuperSocket.send(self, x) except socket.error, msg: if msg[0] == 22 and len(x) < conf.min_pkt_size: - padding = "\x00" * (conf.min_pkt_size - len(x)) + padding = b"\x00" * (conf.min_pkt_size - len(x)) if isinstance(x, Packet): return SuperSocket.send(self, x / Padding(load=padding)) else: diff --git a/scapy/arch/pcapdnet.py b/scapy/arch/pcapdnet.py index 98c2d59c9f9898580e95329bd3255acf37fac933..d7b42e75f708bdd03c041c1e70b56b45a1bab3ec 100644 --- a/scapy/arch/pcapdnet.py +++ b/scapy/arch/pcapdnet.py @@ -67,7 +67,7 @@ if conf.use_winpcapy: def get_if_raw_hwaddr(iff): err = create_string_buffer(PCAP_ERRBUF_SIZE) devs = POINTER(pcap_if_t)() - ret = "\0\0\0\0\0\0" + ret = b"\0\0\0\0\0\0" if pcap_findalldevs(byref(devs), err) < 0: return ret @@ -90,7 +90,7 @@ if conf.use_winpcapy: def get_if_raw_addr(iff): err = create_string_buffer(PCAP_ERRBUF_SIZE) devs = POINTER(pcap_if_t)() - ret = "\0\0\0\0" + ret = b"\0\0\0\0" if pcap_findalldevs(byref(devs), err) < 0: return ret @@ -491,10 +491,10 @@ if conf.use_dnet: conf.use_dnet = False def get_if_raw_hwaddr(iff): "dummy" - return (0,"\0\0\0\0\0\0") + return (0,b"\0\0\0\0\0\0") def get_if_raw_addr(iff): "dummy" - return "\0\0\0\0" + return b"\0\0\0\0" def get_if_list(): "dummy" return [] @@ -506,7 +506,7 @@ if conf.use_dnet: address corresponding to the interface 'iff'""" if iff == scapy.arch.LOOPBACK_NAME: - return (ARPHDR_LOOPBACK, '\x00'*6) + return (ARPHDR_LOOPBACK, b'\x00'*6) # Retrieve interface information try: @@ -536,7 +536,7 @@ if conf.use_dnet: return i.get(ifname)["addr"].data except OSError: warning("No MAC address found on %s !" % ifname) - return "\0\0\0\0" + return b"\0\0\0\0" def get_if_list(): diff --git a/scapy/asn1/ber.py b/scapy/asn1/ber.py index 3a51187bdbdc671048a2e375007a20f21e543c05..9c5565698f3abd75010fe2779ddcb6b027afabc8 100644 --- a/scapy/asn1/ber.py +++ b/scapy/asn1/ber.py @@ -108,9 +108,9 @@ def BER_id_dec(s): # Let's recall that bits 8-7 from the first byte of the tag encode # the class information, while bit 6 means primitive or constructive. # - # For instance, with low-tag-number '\x81', class would be 0b10 + # For instance, with low-tag-number b'\x81', class would be 0b10 # ('context-specific') and tag 0x01, but we return 0x81 as a whole. - # For '\xff\x22', class would be 0b11 ('private'), constructed, then + # For b'\xff\x22', class would be 0b11 ('private'), constructed, then # padding, then tag 0x22, but we return (0xff>>5)*128^1 + 0x22*128^0. # Why the 5-bit-shifting? Because it provides an unequivocal encoding # on base 128 (note that 0xff would equal 1*128^1 + 127*128^0...), @@ -345,7 +345,7 @@ class BERcodec_NULL(BERcodec_INTEGER): @classmethod def enc(cls, i): if i == 0: - return chr(cls.tag)+"\0" + return chr(cls.tag)+b"\0" else: return super(cls,cls).enc(i) diff --git a/scapy/config.py b/scapy/config.py index 9353795878f5e3cb0908cbad6daa1ecfe86d1d52..4b93dc719fd317f6606bbbec1f30c7e183c1e5e1 100755 --- a/scapy/config.py +++ b/scapy/config.py @@ -300,7 +300,7 @@ def _prompt_changer(attr,val): ## ^A and ^B delimit invisible characters for readline to count right. ## And we need ct.prompt() to do change something or else ^A and ^B will be ## displayed - prompt = "\001%s\002" % ct.prompt("\002"+prompt+"\001") + prompt = b"\001%s\002" % ct.prompt(b"\002"+prompt+b"\001") else: prompt = ct.prompt(prompt) except: diff --git a/scapy/contrib/HomePlugAV.py b/scapy/contrib/HomePlugAV.py index 704720f3f3e9d39e51148a314fc6864bdccbf35b..76ebb95e467a529472f645f7eaa819817a60f3c0 100644 --- a/scapy/contrib/HomePlugAV.py +++ b/scapy/contrib/HomePlugAV.py @@ -156,8 +156,8 @@ class GetDeviceVersion(Packet): fields_desc=[ ByteEnumField("Status", 0x0, StatusCodes), ByteEnumField("DeviceID",0x20, HPAVDeviceIDList), FieldLenField("VersionLen", None, count_of="DeviceVersion", fmt="B"), - StrLenField("DeviceVersion", "NoVersion\x00", length_from = lambda pkt: pkt.VersionLen), - StrLenField("DeviceVersion_pad", "\xcc\xcc\xcc\xcc\xcc"+"\x00"*59, length_from = lambda pkt: 64-pkt.VersionLen), + StrLenField("DeviceVersion", b"NoVersion\x00", length_from = lambda pkt: pkt.VersionLen), + StrLenField("DeviceVersion_pad", b"\xcc\xcc\xcc\xcc\xcc"+b"\x00"*59, length_from = lambda pkt: 64-pkt.VersionLen), ByteEnumField("Upgradable", 0, {0:"False",1:"True"}) ] class NetworkInformationRequest(Packet): @@ -172,7 +172,7 @@ class NetworkInfoV10(Packet): Network Information Element """ name = "NetworkInfo" - fields_desc = [ StrFixedLenField("NetworkID", "\x00\x00\x00\x00\x00\x00\x00", 7), + fields_desc = [ StrFixedLenField("NetworkID", b"\x00\x00\x00\x00\x00\x00\x00", 7), XByteField("ShortNetworkID", 0x00), XByteField("TerminalEID", 0x01), ByteEnumField("StationRole", 0x00, StationRole), @@ -204,7 +204,7 @@ class NetworkInfoV11(Packet): Network Information Element """ name = "NetworkInfo" - fields_desc = [ StrFixedLenField("NetworkID", "\x00\x00\x00\x00\x00\x00\x00", 7), + fields_desc = [ StrFixedLenField("NetworkID", b"\x00\x00\x00\x00\x00\x00\x00", 7), ShortField("reserved_1", 0x0000), XByteField("ShortNetworkID", 0x00), XByteField("TerminalEID", 0x01), @@ -255,11 +255,11 @@ class NetworkInfoConfirmationV11(Packet): This introduce few 'crazy' reserved bytes -> have fun! """ name = "NetworkInfoConfirmation" - fields_desc= [ StrFixedLenField("reserved_n1", "\x00\x00\x3a\x00\x00", 5), + fields_desc= [ StrFixedLenField("reserved_n1", b"\x00\x00\x3a\x00\x00", 5), XByteField("LogicalNetworksNumber", 0x01), PacketListField("NetworksInfos", "", NetworkInfoV11, length_from=lambda pkt: pkt.LogicalNetworksNumber * 26), XByteField("StationsNumber", 0x01), - StrFixedLenField("reserverd_s1", "\x00\x00\x00\x00\x00", 5), + StrFixedLenField("reserverd_s1", b"\x00\x00\x00\x00\x00", 5), PacketListField("StationsInfos", "", StationInfoV11, length_from=lambda pkt: pkt.StationsNumber * 23) ] @@ -295,12 +295,12 @@ class SetEncryptionKeyRequest(Packet): name = "SetEncryptionKeyRequest" fields_desc=[ XByteField("EKS", 0x00), StrFixedLenField("NMK", - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16), XByteField("PayloadEncKeySelect", 0x00), MACField("DestinationMAC", "ff:ff:ff:ff:ff:ff"), StrFixedLenField("DAK", - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) ] SetEncKey_Status = { 0x00 : "Success", @@ -416,7 +416,7 @@ class ReadMACMemoryConfirmation(Packet): fields_desc=[ ByteEnumField("Status", 0x00 , ReadMACStatus), LEIntField("Address" , 0), FieldLenField("MACLen", None, length_of="MACData", fmt="<H"), - StrLenField("MACData", "\x00", length_from = lambda pkt: pkt.MACLen), + StrLenField("MACData", b"\x00", length_from = lambda pkt: pkt.MACLen), ] ###################################################################### @@ -450,7 +450,7 @@ class ReadModuleDataConfirmation(Packet): FieldLenField("DataLen", None, count_of="ModuleData", fmt="<H"), LEIntField("Offset", 0x00000000), LEIntField("checksum", None), - StrLenField("ModuleData", "\x00", length_from = lambda pkt: pkt.DataLen), + StrLenField("ModuleData", b"\x00", length_from = lambda pkt: pkt.DataLen), ] def post_build(self, p, pay): @@ -473,7 +473,7 @@ class WriteModuleDataRequest(Packet): FieldLenField("DataLen", None, count_of="ModuleData", fmt="<H"), LEIntField("Offset", 0x00000000), LEIntField("checksum", None), - StrLenField("ModuleData", "\x00", length_from = lambda pkt: pkt.DataLen), + StrLenField("ModuleData", b"\x00", length_from = lambda pkt: pkt.DataLen), ] def post_build(self, p, pay): @@ -495,7 +495,7 @@ class ClassifierPriorityMap(Packet): LEIntField("PID" , 0), LEIntField("IndividualOperand" , 0), StrFixedLenField("ClassifierValue", - "\x00"*16, + b"\x00"*16, 16), ] @@ -508,7 +508,7 @@ class ClassifierObj(Packet): fields_desc=[ LEIntField("ClassifierPID", 0), LEIntField("IndividualOperand", 0), StrFixedLenField("ClassifierValue", - "\x00"*16, + b"\x00"*16, 16), ] @@ -529,11 +529,11 @@ class AutoConnection(Packet): LEIntField("ConnTTL", 0), ShortField("CSPECversion", 0), StrFixedLenField("VlanTag", - "\x00"*4, + b"\x00"*4, 4), XIntField("reserved_1", 0), StrFixedLenField("reserved_2", - "\x00"*14, + b"\x00"*14, 14), ] @@ -676,25 +676,25 @@ class ModulePIB(Packet): ConditionalField(MACField("PIBMACAddr", "00:00:00:00:00:00"), lambda pkt:(0xC >= pkt.__offset and 0x12 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("DAK", - "\x00"*16, + b"\x00"*16, 16), lambda pkt:(0x12 >= pkt.__offset and 0x22 <= pkt.__offset+pkt.__length)), ConditionalField(XShortField("reserved_3" , 0x0000), lambda pkt:(0x22 >= pkt.__offset and 0x24 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("ManufactorID", - "\x00"*64, + b"\x00"*64, 64), lambda pkt:(0x24 >= pkt.__offset and 0x64 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("NMK", - "\x00"*16, + b"\x00"*16, 16), lambda pkt:(0x64 >= pkt.__offset and 0x74 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("UserID", - "\x00"*64, + b"\x00"*64, 64), lambda pkt:(0x74 >= pkt.__offset and 0xB4 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("AVLN_ID", - "\x00"*64, + b"\x00"*64, 64), lambda pkt:(0xB4 >= pkt.__offset and 0xF4 <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("CCoSelection", 0x00), @@ -706,7 +706,7 @@ class ModulePIB(Packet): ConditionalField(XByteField("H3CDowngradeShld", 0x00), lambda pkt:(0xF7 >= pkt.__offset and 0xF8 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("PreferredNID", - "\x00"*7, + b"\x00"*7, 7), lambda pkt:(0xF8 >= pkt.__offset and 0xFF <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("AutoFWUpgradeable", 0x00), @@ -736,7 +736,7 @@ class ModulePIB(Packet): ConditionalField(PacketListField("PeerNodes", "", PeerNode, length_from=lambda x: 56), lambda pkt:(0x116 >= pkt.__offset and 0x11C <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_5", - "\x00"*62, + b"\x00"*62, 62), lambda pkt:(0x146 >= pkt.__offset and 0x14e <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("OverideModeDefaults" , 0x00), @@ -790,7 +790,7 @@ class ModulePIB(Packet): ConditionalField(XShortField("PCISybsystemVendorID" , 0x0000), lambda pkt:(0x1AA >= pkt.__offset and 0x1AC <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_8", - "\x00"*64, + b"\x00"*64, 64), lambda pkt:(0x1AC >= pkt.__offset and 0x1EC <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("OverrideIGMPDefaults" , 0x00), @@ -800,7 +800,7 @@ class ModulePIB(Packet): ConditionalField(XByteField("NumCpToSend_PLFrames" , 0x00), lambda pkt:(0x1EE >= pkt.__offset and 0x1EF <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_9", - "\x00"*29, + b"\x00"*29, 29), lambda pkt:(0x1EF >= pkt.__offset and 0x20C <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("UniCastPriority" , 0x00), @@ -842,7 +842,7 @@ class ModulePIB(Packet): ConditionalField(PacketListField("RSVD_CustomAggregationParameters", "", RSVD_CustomAggregationParameter, length_from=lambda x: 48), lambda pkt:(0x961 >= pkt.__offset and 0x991 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_11", - "\x00"*123, + b"\x00"*123, 123), lambda pkt:(0x991 >= pkt.__offset and 0xA0C <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("ToneMaskType" , 0), @@ -854,7 +854,7 @@ class ModulePIB(Packet): ConditionalField(XIntField("EndTone" , 0), lambda pkt:(0xA18 >= pkt.__offset and 0xA1C <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_12", - "\x00"*12, + b"\x00"*12, 12), lambda pkt:(0xA1C >= pkt.__offset and 0xA28 <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("PsdIndex" , 0), @@ -864,7 +864,7 @@ class ModulePIB(Packet): ConditionalField(PacketListField("PrescalerValues", "", PrescalerValue, length_from=lambda x: 3600), lambda pkt:(0xA30 >= pkt.__offset and 0xA34 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_13", - "\x00"*1484, + b"\x00"*1484, 1484), lambda pkt:(0x1840 >= pkt.__offset and 0x1E0C <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("AllowNEKRotation" , 0), @@ -872,7 +872,7 @@ class ModulePIB(Packet): ConditionalField(XIntField("OverrideLocalNEK" , 0), lambda pkt:(0x1E10 >= pkt.__offset and 0x1E14 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("LocalNEKToUse", - "\x00"*16, + b"\x00"*16, 16), lambda pkt:(0x1E14 >= pkt.__offset and 0x1E24 <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("OverrideNEKRotationTimer" , 0), @@ -880,7 +880,7 @@ class ModulePIB(Packet): ConditionalField(XIntField("NEKRotationTime_Min" , 0), lambda pkt:(0x1E28 >= pkt.__offset and 0x1E2C <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_14", - "\x00"*96, + b"\x00"*96, 96), lambda pkt:(0x1E2C >= pkt.__offset and 0x1E8C <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("AVLNMembership" , 0), @@ -912,13 +912,13 @@ class ModulePIB(Packet): ConditionalField(XByteField("EnableTrafficClass_DSCPOver" , 0), lambda pkt:(0x1EB8 >= pkt.__offset and 0x1EB9 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("TrafficClass_DSCPMatrices", - "\x00"*64, + b"\x00"*64, 64), lambda pkt:(0x1EB9 >= pkt.__offset and 0x1EF9 <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("GPIOControl" , 0), lambda pkt:(0x1EF9 >= pkt.__offset and 0x1EFA <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("LEDControl", - "\x00"*32, + b"\x00"*32, 32), lambda pkt:(0x1EFA >= pkt.__offset and 0x1F1A <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("OverrideMinButtonPressHoldTime" , 0), @@ -926,7 +926,7 @@ class ModulePIB(Packet): ConditionalField(LEIntField("MinButtonPressHoldTime" , 0), lambda pkt:(0x1F1E >= pkt.__offset and 0x1F22 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_17", - "\x00"*22, + b"\x00"*22, 22), lambda pkt:(0x1F22 >= pkt.__offset and 0x1F38 <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("MemoryProfile" , 0), @@ -972,7 +972,7 @@ class ModulePIB(Packet): ConditionalField(XByteField("ReservedPercentageForRxStreams" , 0), lambda pkt:(0x1F71 >= pkt.__offset and 0x1F72 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_20", - "\x00"*22, + b"\x00"*22, 22), lambda pkt:(0x1F72 >= pkt.__offset and 0x1F88 <= pkt.__offset+pkt.__length)), ConditionalField(XIntField("LegacyNetworkUpgradeEnable" , 0), @@ -1020,7 +1020,7 @@ class ModulePIB(Packet): ConditionalField(XByteField("ContinuousRx" , 0), lambda pkt:(0x1FC1 >= pkt.__offset and 0x1FC2 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_22", - "\x00"*6, + b"\x00"*6, 6), lambda pkt:(0x1FC2 >= pkt.__offset and 0x1FC8 <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("PBControlStatus" , 0), @@ -1034,7 +1034,7 @@ class ModulePIB(Packet): ConditionalField(XByteField("ChainingEnabled" , 0), lambda pkt:(0x1FCC >= pkt.__offset and 0x1FCD <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("VendorSpecificNMK", - "\x00"*16, + b"\x00"*16, 16), lambda pkt:(0x1FCD >= pkt.__offset and 0x1FDD <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("LocalMACAddressLimit" , 0), @@ -1054,7 +1054,7 @@ class ModulePIB(Packet): ConditionalField(XIntField("reserved_25" , 0), lambda pkt:(0x1FEC >= pkt.__offset and 0x1FF0 <= pkt.__offset+pkt.__length)), ConditionalField(StrFixedLenField("reserved_26", - "\x00"*24, + b"\x00"*24, 24), lambda pkt:(0x1FF0 >= pkt.__offset and 0x2008 <= pkt.__offset+pkt.__length)), ConditionalField(XByteField("OverrideDefaultLedEventBehavior" , 0x80), diff --git a/scapy/contrib/HomePlugAV.uts b/scapy/contrib/HomePlugAV.uts index a1ca8558dd18b4f3fc314c83ef14bde124c0091e..0982e97e546f42b862aa47b6df43d25fd198781e 100644 --- a/scapy/contrib/HomePlugAV.uts +++ b/scapy/contrib/HomePlugAV.uts @@ -49,28 +49,28 @@ pkt = HomePlugAV()/SetEncryptionKeyRequest() pkt.NMK = "A" * 16 pkt.DAK = "B" * 16 str(pkt) -_ == "\x00P\xa0\x00\xb0R\x00AAAAAAAAAAAAAAAA\x00\xff\xff\xff\xff\xff\xffBBBBBBBBBBBBBBBB" +_ == b"\x00P\xa0\x00\xb0R\x00AAAAAAAAAAAAAAAA\x00\xff\xff\xff\xff\xff\xffBBBBBBBBBBBBBBBB" pkt = HomePlugAV()/ReadMACMemoryRequest() pkt.Address = 0x31337 pkt.Length = 0x666 str(pkt) -_ == "\x00\x08\xa0\x00\xb0R7\x13\x03\x00f\x06\x00\x00" +_ == b"\x00\x08\xa0\x00\xb0R7\x13\x03\x00f\x06\x00\x00" pkt = HomePlugAV()/ReadModuleDataRequest() pkt.Length = 0x666 pkt.Offset = 0x1337 str(pkt) -assert(_ == "\x00$\xa0\x00\xb0R\x02\x00f\x067\x13\x00\x00") +assert(_ == b"\x00$\xa0\x00\xb0R\x02\x00f\x067\x13\x00\x00") pkt = HomePlugAV()/SnifferRequest() pkt.SnifferControl = 0x1 str(pkt) -_ == "\x004\xa0\x00\xb0R\x01" +_ == b"\x004\xa0\x00\xb0R\x01" = Some important fields parsing ~ field -_xstr = "\x00%\xa0\x00\xb0R\x00\x00\x00\x00\x02\x00\x00\x04\x00\x00\x00\x00`\x8d\x05\xf9\x04\x01\x00\x00\x88)\x00\x00\x87`[\x14\x00$\xd4okm\x1f\xedHu\x85\x16>\x86\x1aKM\xd2\xe91\xfc6\x00\x00603506A112119017\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00z]\xa9\xe2]\xedR\x8b\x85\\\xdf\xe8~\xe9\xb2\x14637000A112139290\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00FREEPLUG_LC_6400_4-1_1.0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbb\xcb\x0e\x10 \xad\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00`\xe5\x16\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x03\x02\x80\x84\x1e\x00\x80\x84\x1e\x00\xe0\x93\x04\x00\xe0\x93\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +_xstr = b"\x00%\xa0\x00\xb0R\x00\x00\x00\x00\x02\x00\x00\x04\x00\x00\x00\x00`\x8d\x05\xf9\x04\x01\x00\x00\x88)\x00\x00\x87`[\x14\x00$\xd4okm\x1f\xedHu\x85\x16>\x86\x1aKM\xd2\xe91\xfc6\x00\x00603506A112119017\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00z]\xa9\xe2]\xedR\x8b\x85\\\xdf\xe8~\xe9\xb2\x14637000A112139290\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00FREEPLUG_LC_6400_4-1_1.0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbb\xcb\x0e\x10 \xad\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00`\xe5\x16\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x03\x02\x80\x84\x1e\x00\x80\x84\x1e\x00\xe0\x93\x04\x00\xe0\x93\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" pkt = HomePlugAV(_xstr) ReadModuleDataConfirmation in pkt @@ -79,7 +79,7 @@ _ == True _ == (True, True, True, True) ModulePIB(pkt.ModuleData, pkt.Offset, pkt.DataLen) -(_.NMK == "z]\xa9\xe2]\xedR\x8b\x85\\\xdf\xe8~\xe9\xb2\x14", _.DAK == "\x1f\xedHu\x85\x16>\x86\x1aKM\xd2\xe91\xfc6") +(_.NMK == b"z]\xa9\xe2]\xedR\x8b\x85\\\xdf\xe8~\xe9\xb2\x14", _.DAK == b"\x1f\xedHu\x85\x16>\x86\x1aKM\xd2\xe91\xfc6") _ == (True, True) #= Discovery packet tests in local @@ -102,7 +102,7 @@ _ == (True, True) #_ == True = Testing length and checksum on a generated Write Module Data Request -string = "goodchoucroute\x00\x00" +string = b"goodchoucroute\x00\x00" pkt = WriteModuleDataRequest(ModuleData=string) pkt = WriteModuleDataRequest(pkt.build()) pkt.show() diff --git a/scapy/contrib/avs.py b/scapy/contrib/avs.py index b31d58ecda1b6a62e7321d38a1244d4a91437446..8f40aff1ec9c37bf69664ca0572bb62590398388 100644 --- a/scapy/contrib/avs.py +++ b/scapy/contrib/avs.py @@ -35,22 +35,22 @@ AVSWLANPreambleType = { 0 : "Unknown", class AVSWLANHeader(Packet): - """ iwpriv eth1 set_prismhdr 1 """ - name = "AVS WLAN Monitor Header" - fields_desc = [ IntField("version",1), - IntField("len",64), - LongField("mactime",0), - LongField("hosttime",0), - IntEnumField("phytype",0, AVSWLANPhyType), - IntField("channel",0), - IntField("datarate",0), - IntField("antenna",0), - IntField("priority",0), - IntEnumField("ssi_type",0, AVSWLANSSIType), - SignedIntField("ssi_signal",0), - SignedIntField("ssi_noise",0), - IntEnumField("preamble",0, AVSWLANPreambleType), - IntEnumField("encoding",0, AVSWLANEncodingType), - ] + """ iwpriv eth1 set_prismhdr 1 """ + name = "AVS WLAN Monitor Header" + fields_desc = [ IntField("version",1), + IntField("len",64), + LongField("mactime",0), + LongField("hosttime",0), + IntEnumField("phytype",0, AVSWLANPhyType), + IntField("channel",0), + IntField("datarate",0), + IntField("antenna",0), + IntField("priority",0), + IntEnumField("ssi_type",0, AVSWLANSSIType), + SignedIntField("ssi_signal",0), + SignedIntField("ssi_noise",0), + IntEnumField("preamble",0, AVSWLANPreambleType), + IntEnumField("encoding",0, AVSWLANEncodingType), + ] bind_layers(AVSWLANHeader, Dot11) diff --git a/scapy/contrib/bgp.py b/scapy/contrib/bgp.py index 8ff0becc67c615eec2e58d0abde40c6f6aad2315..d24dd58eea3ca1d70b03382d923d5c90461e562e 100644 --- a/scapy/contrib/bgp.py +++ b/scapy/contrib/bgp.py @@ -60,7 +60,7 @@ _BGP_HEADER_SIZE = 19 # Marker included in every message (RFC 4271: "This 16-octet field is # included for compatibility; it MUST be set to all ones") -_BGP_HEADER_MARKER = "\xff" * 16 +_BGP_HEADER_MARKER = b"\xff" * 16 # extended-length flag (RFC 4271 4.3. UPDATE Message Format - # Path Attributes) @@ -131,7 +131,7 @@ class BGPFieldIPv4(Field): mask = struct.unpack(">B", m[0])[0] mask2iplen_res = self.mask2iplen(mask) ip = "".join( - [m[i + 1] if i < mask2iplen_res else "\x00" for i in range(4)]) + [m[i + 1] if i < mask2iplen_res else b"\x00" for i in range(4)]) return (mask, socket.inet_ntoa(ip)) @@ -175,7 +175,7 @@ class BGPFieldIPv6(Field): def m2i(self, pkt, m): mask = struct.unpack(">B", m[0])[0] ip = "".join( - [m[i + 1] if i < self.mask2iplen(mask) else "\x00" for i in range(16)]) + [m[i + 1] if i < self.mask2iplen(mask) else b"\x00" for i in range(16)]) return (mask, pton_ntop.inet_ntop(socket.AF_INET6, ip)) diff --git a/scapy/contrib/bgp.uts b/scapy/contrib/bgp.uts index 489cdd7a21008aa5917be270dacc0cffd86b870b..3a2997df266576d2396ed749c6eb9d756cce05b6 100644 --- a/scapy/contrib/bgp.uts +++ b/scapy/contrib/bgp.uts @@ -8,23 +8,23 @@ bgp_module_conf.use_2_bytes_asn = True + BGPNLRI_IPv4 class tests = BGPNLRI_IPv4 - Instantiation -str(BGPNLRI_IPv4()) == '\x00' +str(BGPNLRI_IPv4()) == b'\x00' = BGPNLRI_IPv4 - Instantiation with specific values (1) -str(BGPNLRI_IPv4(prefix = '255.255.255.255/32')) == ' \xff\xff\xff\xff' +str(BGPNLRI_IPv4(prefix = '255.255.255.255/32')) == b' \xff\xff\xff\xff' = BGPNLRI_IPv4 - Instantiation with specific values (2) -str(BGPNLRI_IPv4(prefix = '0.0.0.0/0')) == '\x00' +str(BGPNLRI_IPv4(prefix = '0.0.0.0/0')) == b'\x00' = BGPNLRI_IPv4 - Instantiation with specific values (3) -str(BGPNLRI_IPv4(prefix = '192.0.2.0/24')) == '\x18\xc0\x00\x02' +str(BGPNLRI_IPv4(prefix = '192.0.2.0/24')) == b'\x18\xc0\x00\x02' = BGPNLRI_IPv4 - Basic dissection -nlri = BGPNLRI_IPv4('\x00') +nlri = BGPNLRI_IPv4(b'\x00') nlri.prefix == '0.0.0.0/0' = BGPNLRI_IPv4 - Dissection with specific values -nlri = BGPNLRI_IPv4('\x18\xc0\x00\x02') +nlri = BGPNLRI_IPv4(b'\x18\xc0\x00\x02') nlri.prefix == '192.0.2.0/24' @@ -32,20 +32,20 @@ nlri.prefix == '192.0.2.0/24' + BGPNLRI_IPv6 class tests = BGPNLRI_IPv6 - Instantiation -str(BGPNLRI_IPv6()) == '\x00' +str(BGPNLRI_IPv6()) == b'\x00' = BGPNLRI_IPv6 - Instantiation with specific values (1) -str(BGPNLRI_IPv6(prefix = '::/0')) == '\x00' +str(BGPNLRI_IPv6(prefix = '::/0')) == b'\x00' = BGPNLRI_IPv6 - Instantiation with specific values (2) -str(BGPNLRI_IPv6(prefix = '2001:db8::/32')) == ' \x01\r\xb8' +str(BGPNLRI_IPv6(prefix = '2001:db8::/32')) == b' \x01\r\xb8' = BGPNLRI_IPv6 - Basic dissection -nlri = BGPNLRI_IPv6('\x00') +nlri = BGPNLRI_IPv6(b'\x00') nlri.prefix == '::/0' = BGPNLRI_IPv6 - Dissection with specific values -nlri = BGPNLRI_IPv6(' \x01\r\xb8') +nlri = BGPNLRI_IPv6(b' \x01\r\xb8') nlri.prefix == '2001:db8::/32' @@ -54,34 +54,34 @@ nlri.prefix == '2001:db8::/32' = BGP - Instantiation (Should be a KEEPALIVE) m = BGP() -assert(str(m) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') +assert(str(m) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') assert(m.type == BGP.KEEPALIVE_TYPE) = BGP - Instantiation with specific values (1) -str(BGP(type = 0)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x00' +str(BGP(type = 0)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x00' = BGP - Instantiation with specific values (2) -str(BGP(type = 1)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01' +str(BGP(type = 1)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01' = BGP - Instantiation with specific values (3) -str(BGP(type = 2)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x02' +str(BGP(type = 2)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x02' = BGP - Instantiation with specific values (4) -str(BGP(type = 3)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x03' +str(BGP(type = 3)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x03' = BGP - Instantiation with specific values (5) -str(BGP(type = 4)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' +str(BGP(type = 4)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' = BGP - Instantiation with specific values (6) -str(BGP(type = 5)) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x05' +str(BGP(type = 5)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x05' = BGP - Basic dissection -h = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') +h = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') assert(h.type == BGP.KEEPALIVE_TYPE) assert(h.len == 19) = BGP - Dissection with specific values -h = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01') +h = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01') assert(h.type == BGP.OPEN_TYPE) assert(h.len == 19) @@ -91,11 +91,11 @@ assert(h.len == 19) = BGPCapability - Instantiation (by default, should be a "generic" capability) str(BGPCapability()) -str(BGPCapability()) == '\x00\x00' +str(BGPCapability()) == b'\x00\x00' = BGPCapability - Instantiation with specific values (1) c = BGPCapability(code = 70) -assert(str(c) == 'F\x00') +assert(str(c) == b'F\x00') ############################ BGPCapMultiprotocol ############################## @@ -106,16 +106,16 @@ c = BGPCapMultiprotocol() assert(isinstance(c, BGPCapability)) = BGPCapMultiprotocol - Instantiation -str(BGPCapMultiprotocol()) == '\x01\x04\x00\x00\x00\x00' +str(BGPCapMultiprotocol()) == b'\x01\x04\x00\x00\x00\x00' = BGPCapMultiprotocol - Instantiation with specific values (1) -str(BGPCapMultiprotocol(afi = 1, safi = 1)) == '\x01\x04\x00\x01\x00\x01' +str(BGPCapMultiprotocol(afi = 1, safi = 1)) == b'\x01\x04\x00\x01\x00\x01' = BGPCapMultiprotocol - Instantiation with specific values (2) -str(BGPCapMultiprotocol(afi = 2, safi = 1)) == '\x01\x04\x00\x02\x00\x01' +str(BGPCapMultiprotocol(afi = 2, safi = 1)) == b'\x01\x04\x00\x02\x00\x01' = BGPCapMultiprotocol - Dissection with specific values -c = BGPCapMultiprotocol('\x01\x04\x00\x02\x00\x01') +c = BGPCapMultiprotocol(b'\x01\x04\x00\x02\x00\x01') assert(c.code == 1) assert(c.length == 4) assert(c.afi == 2) @@ -126,20 +126,20 @@ assert(c.safi == 1) + BGPCapORFBlock class tests = BGPCapORFBlock - Instantiation -str(BGPCapORFBlock()) == '\x00\x00\x00\x00\x00' +str(BGPCapORFBlock()) == b'\x00\x00\x00\x00\x00' = BGPCapORFBlock - Instantiation with specific values (1) -str(BGPCapORFBlock(afi = 1, safi = 1)) == '\x00\x01\x00\x01\x00' +str(BGPCapORFBlock(afi = 1, safi = 1)) == b'\x00\x01\x00\x01\x00' = BGPCapORFBlock - Instantiation with specific values (2) -str(BGPCapORFBlock(afi = 2, safi = 1)) == '\x00\x02\x00\x01\x00' +str(BGPCapORFBlock(afi = 2, safi = 1)) == b'\x00\x02\x00\x01\x00' = BGPCapORFBlock - Basic dissection -c = BGPCapORFBlock('\x00\x00\x00\x00\x00') +c = BGPCapORFBlock(b'\x00\x00\x00\x00\x00') c.afi == 0 and c.reserved == 0 and c.safi == 0 and c.orf_number == 0 = BGPCapORFBlock - Dissection with specific values -c = BGPCapORFBlock('\x00\x02\x00\x01\x00') +c = BGPCapORFBlock(b'\x00\x02\x00\x01\x00') c.afi == 2 and c.reserved == 0 and c.safi == 1 and c.orf_number == 0 @@ -147,17 +147,17 @@ c.afi == 2 and c.reserved == 0 and c.safi == 1 and c.orf_number == 0 + BGPCapORFBlock.ORF class tests = BGPCapORFBlock.ORF - Instantiation -str(BGPCapORFBlock.ORFTuple()) == '\x00\x00' +str(BGPCapORFBlock.ORFTuple()) == b'\x00\x00' = BGPCapORFBlock.ORF - Instantiation with specific values (1) -str(BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)) == '@\x03' +str(BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)) == b'@\x03' = BGPCapORFBlock.ORF - Basic dissection -c = BGPCapORFBlock.ORFTuple('\x00\x00') +c = BGPCapORFBlock.ORFTuple(b'\x00\x00') c.orf_type == 0 and c.send_receive == 0 = BGPCapORFBlock.ORF - Dissection with specific values -c = BGPCapORFBlock.ORFTuple('@\x03') +c = BGPCapORFBlock.ORFTuple(b'@\x03') c.orf_type == 64 and c.send_receive == 3 @@ -169,16 +169,16 @@ c = BGPCapORF() assert(isinstance(c, BGPCapability)) = BGPCapORF - Instantiation -str(BGPCapORF()) == '\x03\x00' +str(BGPCapORF()) == b'\x03\x00' = BGPCapORF - Instantiation with specific values (1) -str(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == '\x03\x07\x00\x01\x00\x01\x01@\x03' +str(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == b'\x03\x07\x00\x01\x00\x01\x01@\x03' = BGPCapORF - Instantiation with specific values (2) -str(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)]), BGPCapORFBlock(afi = 2, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == '\x03\x0e\x00\x01\x00\x01\x01@\x03\x00\x02\x00\x01\x01@\x03' +str(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)]), BGPCapORFBlock(afi = 2, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == b'\x03\x0e\x00\x01\x00\x01\x01@\x03\x00\x02\x00\x01\x01@\x03' = BGPCapORF - Basic dissection -c = BGPCapORF('\x03\x00') +c = BGPCapORF(b'\x03\x00') c.code == 3 and c.length == 0 = BGPCapORF - Dissection with specific values @@ -190,17 +190,17 @@ c.code == 3 and c.orf[0].afi == 1 and c.orf[0].safi == 1 and c.orf[0].entries[0] + BGPCapGracefulRestart.GRTuple class tests = BGPCapGracefulRestart.GRTuple - Instantiation -str(BGPCapGracefulRestart.GRTuple()) == '\x00\x00\x00\x00' +str(BGPCapGracefulRestart.GRTuple()) == b'\x00\x00\x00\x00' = BGPCapGracefulRestart.GRTuple - Instantiation with specific values -str(BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)) == '\x00\x01\x01\x80' +str(BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)) == b'\x00\x01\x01\x80' = BGPCapGracefulRestart.GRTuple - Basic dissection -c = BGPCapGracefulRestart.GRTuple('\x00\x00\x00\x00') +c = BGPCapGracefulRestart.GRTuple(b'\x00\x00\x00\x00') c.afi == 0 and c.safi == 0 and c.flags == 0 = BGPCapGracefulRestart.GRTuple - Dissection with specific values -c = BGPCapGracefulRestart.GRTuple('\x00\x01\x01\x80') +c = BGPCapGracefulRestart.GRTuple(b'\x00\x01\x01\x80') c.afi == 1 and c.safi == 1 and c.flags == 128 @@ -212,26 +212,26 @@ c = BGPCapGracefulRestart() assert(isinstance(c, BGPCapGracefulRestart)) = BGPCapGracefulRestart - Instantiation -str(BGPCapGracefulRestart()) == '@\x02\x00\x00' +str(BGPCapGracefulRestart()) == b'@\x02\x00\x00' = BGPCapGracefulRestart - Instantiation with specific values (1) -str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == '@\x06\x00x\x00\x01\x01\x00' +str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == b'@\x06\x00x\x00\x01\x01\x00' = BGPCapGracefulRestart - Instantiation with specific values (2) -str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == '@\x06\x00x\x00\x01\x01\x00' +str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == b'@\x06\x00x\x00\x01\x01\x00' = BGPCapGracefulRestart - Instantiation with specific values (3) -str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == '@\x06\x00x\x00\x01\x01\x80' +str(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == b'@\x06\x00x\x00\x01\x01\x80' = BGPCapGracefulRestart - Instantiation with specific values (4) -str(BGPCapGracefulRestart(restart_time = 120, restart_flags = 0x8, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == '@\x06\x80x\x00\x01\x01\x80' +str(BGPCapGracefulRestart(restart_time = 120, restart_flags = 0x8, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == b'@\x06\x80x\x00\x01\x01\x80' = BGPCapGracefulRestart - Basic dissection -c = BGPCapGracefulRestart('@\x02\x00\x00') +c = BGPCapGracefulRestart(b'@\x02\x00\x00') c.code == 64 and c.restart_flags == 0 and c.restart_time == 0 = BGPCapGracefulRestart - Dissection with specific values -c = BGPCapGracefulRestart('@\x06\x80x\x00\x01\x01\x80') +c = BGPCapGracefulRestart(b'@\x06\x80x\x00\x01\x01\x80') c.code == 64 and c.restart_time == 120 and c.restart_flags == 0x8 and c.entries[0].afi == 1 and c.entries[0].safi == 1 and c.entries[0].flags == 128 @@ -243,20 +243,20 @@ c = BGPCapFourBytesASN() assert(isinstance(c, BGPCapFourBytesASN)) = BGPCapFourBytesASN - Instantiation -str(BGPCapFourBytesASN()) == 'A\x04\x00\x00\x00\x00' +str(BGPCapFourBytesASN()) == b'A\x04\x00\x00\x00\x00' = BGPCapFourBytesASN - Instantiation with specific values (1) -str(BGPCapFourBytesASN(asn = 6555555)) == 'A\x04\x00d\x07\xa3' +str(BGPCapFourBytesASN(asn = 6555555)) == b'A\x04\x00d\x07\xa3' = BGPCapFourBytesASN - Instantiation with specific values (2) -str(BGPCapFourBytesASN(asn = 4294967295)) == 'A\x04\xff\xff\xff\xff' +str(BGPCapFourBytesASN(asn = 4294967295)) == b'A\x04\xff\xff\xff\xff' = BGPCapFourBytesASN - Basic dissection -c = BGPCapFourBytesASN('A\x04\x00\x00\x00\x00') +c = BGPCapFourBytesASN(b'A\x04\x00\x00\x00\x00') c.code == 65 and c.length == 4 and c.asn == 0 = BGPCapFourBytesASN - Dissection with specific values -c = BGPCapFourBytesASN('A\x04\xff\xff\xff\xff') +c = BGPCapFourBytesASN(b'A\x04\xff\xff\xff\xff') c.code == 65 and c.length == 4 and c.asn == 4294967295 @@ -264,10 +264,10 @@ c.code == 65 and c.length == 4 and c.asn == 4294967295 + BGPAuthenticationInformation class tests = BGPAuthenticationInformation - Instantiation -str(BGPAuthenticationInformation()) == '\x00' +str(BGPAuthenticationInformation()) == b'\x00' = BGPAuthenticationInformation - Basic dissection -c = BGPAuthenticationInformation('\x00') +c = BGPAuthenticationInformation(b'\x00') c.authentication_code == 0 and c.authentication_data == None @@ -275,30 +275,30 @@ c.authentication_code == 0 and c.authentication_data == None + BGPOptParam class tests = BGPOptParam - Instantiation -str(BGPOptParam()) == '\x02\x00' +str(BGPOptParam()) == b'\x02\x00' = BGPOptParam - Instantiation with specific values (1) -str(BGPOptParam(param_type = 1)) == '\x01\x00' -str(BGPOptParam(param_type = 1, param_value = BGPAuthenticationInformation())) == '\x01\x04' +str(BGPOptParam(param_type = 1)) == b'\x01\x00' +str(BGPOptParam(param_type = 1, param_value = BGPAuthenticationInformation())) == b'\x01\x04' = BGPOptParam - Instantiation with specific values (2) -str(BGPOptParam(param_type = 2)) == '\x02\x00' +str(BGPOptParam(param_type = 2)) == b'\x02\x00' = BGPOptParam - Instantiation with specific values (3) -str(BGPOptParam(param_type = 2, param_value = BGPCapFourBytesASN(asn = 4294967295))) == '\x02\x06A\x04\xff\xff\xff\xff' +str(BGPOptParam(param_type = 2, param_value = BGPCapFourBytesASN(asn = 4294967295))) == b'\x02\x06A\x04\xff\xff\xff\xff' = BGPOptParam - Instantiation with specific values (4) -str(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 127))) == '\x02\x02\x7f\x00' +str(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 127))) == b'\x02\x02\x7f\x00' = BGPOptParam - Instantiation with specific values (5) -str(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 255))) == '\x02\x02\xff\x00' +str(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 255))) == b'\x02\x02\xff\x00' = BGPOptParam - Basic dissection -p = BGPOptParam('\x02\x00') +p = BGPOptParam(b'\x02\x00') p.param_type == 2 and p.param_length == 0 = BGPOptParam - Dissection with specific values -p = BGPOptParam('\x02\x06A\x04\xff\xff\xff\xff') +p = BGPOptParam(b'\x02\x06A\x04\xff\xff\xff\xff') p.param_type == 2 and p.param_length == 6 and p.param_value[0].code == 65 and p.param_value[0].length == 4 and p.param_value[0].asn == 4294967295 @@ -306,14 +306,14 @@ p.param_type == 2 and p.param_length == 6 and p.param_value[0].code == 65 and p. + BGPOpen class tests = BGPOpen - Instantiation -str(BGPOpen()) == '\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(BGPOpen()) == b'\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00' = BGPOpen - Instantiation with specific values (1) -str(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1")) == '\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x00' +str(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1")) == b'\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x00' = BGPOpen - Instantiation with specific values (2) opt = BGPOptParam(param_value = BGPCapMultiprotocol(afi = 1, safi = 1)) -str(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1", opt_params = [opt])) == '\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x08\x02\x06\x01\x04\x00\x01\x00\x01' +str(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1", opt_params = [opt])) == b'\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x08\x02\x06\x01\x04\x00\x01\x00\x01' = BGPOpen - Instantiation with specific values (3) cap = BGPOptParam(param_value = BGPCapMultiprotocol(afi = 1, safi = 1)) @@ -326,10 +326,10 @@ cap = BGPOptParam(param_value = BGPCapGracefulRestart(restart_time = 120, entrie capabilities.append(cap) cap = BGPOptParam(param_value = BGPCapFourBytesASN(asn = 64503)) capabilities.append(cap) -str(BGPOpen(my_as = 64503, bgp_id = "192.168.100.3", hold_time = 30, opt_params = capabilities)) == '\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7' +str(BGPOpen(my_as = 64503, bgp_id = "192.168.100.3", hold_time = 30, opt_params = capabilities)) == b'\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7' = BGPOpen - Dissection with specific values (1) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00?\x01\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00?\x01\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7') assert(BGPHeader in m and BGPOpen in m) assert(m.len == 63) assert(m.type == BGP.OPEN_TYPE) @@ -344,16 +344,16 @@ assert(isinstance(m.opt_params[2].param_value, BGPCapability)) assert(isinstance(m.opt_params[3].param_value, BGPCapGracefulRestart)) = BGPOpen - Dissection with specific values (2) (followed by a KEEPALIVE) -messages = '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' +messages = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' m = BGP(messages) -str(m) == '\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' +str(m) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' = BGPOpen - Dissection with specific values (3) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x01r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x80x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x01r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x80x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') assert(BGPHeader in m and BGPOpen in m) = BGPOpen - Dissection with specific values (4) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x02r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x00x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x02r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x00x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') assert(BGPHeader in m and BGPOpen in m) @@ -361,13 +361,13 @@ assert(BGPHeader in m and BGPOpen in m) + BGPPAOrigin class tests = BGPPAOrigin - Instantiation -str(BGPPAOrigin()) == '\x00' +str(BGPPAOrigin()) == b'\x00' = BGPPAOrigin - Instantiation with specific values -str(BGPPAOrigin(origin = 1)) == '\x01' +str(BGPPAOrigin(origin = 1)) == b'\x01' = BGPPAOrigin - Dissection -a = BGPPAOrigin('\x00') +a = BGPPAOrigin(b'\x00') a.origin == 0 @@ -378,20 +378,20 @@ a.origin == 0 str(BGPPAASPath()) == '' = BGPPAASPath - Instantiation with specific values (1) -str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64496, 64497, 64498])])) == '\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2' +str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64496, 64497, 64498])])) == b'\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2' = BGPPAASPath - Instantiation with specific values (2) -str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498])])) == '\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2' +str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498])])) == b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2' = BGPPAASPath - Instantiation with specific values (3) -str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498]), BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64500, 64501, 64502, 64502, 64503])])) == '\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7' +str(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498]), BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64500, 64501, 64502, 64502, 64503])])) == b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7' = BGPPAASPath - Dissection (1) -a = BGPPAASPath('\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2') +a = BGPPAASPath(b'\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2') a.segments[0].segment_type == 2 and a.segments[0].segment_length == 3 and a.segments[0].segment_value == [64496, 64497, 64498] = BGPPAASPath - Dissection (2) -a = BGPPAASPath('\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7') +a = BGPPAASPath(b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7') a.segments[0].segment_type == 1 and a.segments[0].segment_length == 3 and a.segments[0].segment_value == [64496, 64497, 64498] and a.segments[1].segment_type == 2 and a.segments[1].segment_length == 5 and a.segments[1].segment_value == [64500, 64501, 64502, 64502, 64503] @@ -399,17 +399,17 @@ a.segments[0].segment_type == 1 and a.segments[0].segment_length == 3 and a.segm + BGPPANextHop class tests = BGPPANextHop - Instantiation -str(BGPPANextHop()) == '\x00\x00\x00\x00' +str(BGPPANextHop()) == b'\x00\x00\x00\x00' = BGPPANextHop - Instantiation with specific values -str(BGPPANextHop(next_hop = "192.0.2.1")) == '\xc0\x00\x02\x01' +str(BGPPANextHop(next_hop = "192.0.2.1")) == b'\xc0\x00\x02\x01' = BGPPANextHop - Basic dissection -a = BGPPANextHop('\x00\x00\x00\x00') +a = BGPPANextHop(b'\x00\x00\x00\x00') a.next_hop == "0.0.0.0" = BGPPANextHop - Dissection with specific values -a = BGPPANextHop('\xc0\x00\x02\x01') +a = BGPPANextHop(b'\xc0\x00\x02\x01') a.next_hop == '192.0.2.1' @@ -417,13 +417,13 @@ a.next_hop == '192.0.2.1' + BGPPAMultiExitDisc class tests = BGPPAMultiExitDisc - Instantiation -str(BGPPAMultiExitDisc()) == '\x00\x00\x00\x00' +str(BGPPAMultiExitDisc()) == b'\x00\x00\x00\x00' = BGPPAMultiExitDisc - Instantiation with specific values (1) -str(BGPPAMultiExitDisc(med = 4)) == '\x00\x00\x00\x04' +str(BGPPAMultiExitDisc(med = 4)) == b'\x00\x00\x00\x04' = BGPPAMultiExitDisc - Basic dissection -a = BGPPAMultiExitDisc('\x00\x00\x00\x00') +a = BGPPAMultiExitDisc(b'\x00\x00\x00\x00') a.med == 0 @@ -431,13 +431,13 @@ a.med == 0 + BGPPALocalPref class tests = BGPPALocalPref - Instantiation -str(BGPPALocalPref()) == '\x00\x00\x00\x00' +str(BGPPALocalPref()) == b'\x00\x00\x00\x00' = BGPPALocalPref - Instantiation with specific values (1) -str(BGPPALocalPref(local_pref = 110)) == '\x00\x00\x00n' +str(BGPPALocalPref(local_pref = 110)) == b'\x00\x00\x00n' = BGPPALocalPref - Basic dissection -a = BGPPALocalPref('\x00\x00\x00n') +a = BGPPALocalPref(b'\x00\x00\x00n') a.local_pref == 110 @@ -445,13 +445,13 @@ a.local_pref == 110 + BGPPAAggregator class tests = BGPPAAggregator - Instantiation -str(BGPPAAggregator()) == '\x00\x00\x00\x00\x00\x00' +str(BGPPAAggregator()) == b'\x00\x00\x00\x00\x00\x00' = BGPPAAggregator - Instantiation with specific values (1) -str(BGPPAAggregator(aggregator_asn = 64500, speaker_address = "192.0.2.1")) == '\xfb\xf4\xc0\x00\x02\x01' +str(BGPPAAggregator(aggregator_asn = 64500, speaker_address = "192.0.2.1")) == b'\xfb\xf4\xc0\x00\x02\x01' = BGPPAAggregator - Dissection -a = BGPPAAggregator('\xfb\xf4\xc0\x00\x02\x01') +a = BGPPAAggregator(b'\xfb\xf4\xc0\x00\x02\x01') a.aggregator_asn == 64500 and a.speaker_address == "192.0.2.1" @@ -459,13 +459,13 @@ a.aggregator_asn == 64500 and a.speaker_address == "192.0.2.1" + BGPPACommunity class tests = BGPPACommunity - Basic instantiation -str(BGPPACommunity()) == '\x00\x00\x00\x00' +str(BGPPACommunity()) == b'\x00\x00\x00\x00' = BGPPACommunity - Instantiation with specific value -str(BGPPACommunity(community = 0xFFFFFF01)) == '\xff\xff\xff\x01' +str(BGPPACommunity(community = 0xFFFFFF01)) == b'\xff\xff\xff\x01' = BGPPACommunity - Dissection -a = BGPPACommunity('\xff\xff\xff\x01') +a = BGPPACommunity(b'\xff\xff\xff\x01') a.community == 0xFFFFFF01 @@ -473,13 +473,13 @@ a.community == 0xFFFFFF01 + BGPPAOriginatorID class tests = BGPPAOriginatorID - Basic instantiation -str(BGPPAOriginatorID()) == '\x00\x00\x00\x00' +str(BGPPAOriginatorID()) == b'\x00\x00\x00\x00' = BGPPAOriginatorID - Instantiation with specific value -str(BGPPAOriginatorID(originator_id = '192.0.2.1')) == '\xc0\x00\x02\x01' +str(BGPPAOriginatorID(originator_id = '192.0.2.1')) == b'\xc0\x00\x02\x01' = BGPPAOriginatorID - Dissection -a = BGPPAOriginatorID('\xc0\x00\x02\x01') +a = BGPPAOriginatorID(b'\xc0\x00\x02\x01') a.originator_id == "192.0.2.1" @@ -490,10 +490,10 @@ a.originator_id == "192.0.2.1" str(BGPPAClusterList()) == '' = BGPPAClusterList - Instantiation with specific values -str(BGPPAClusterList(cluster_list = [150000, 165465465, 132132])) == '\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$' +str(BGPPAClusterList(cluster_list = [150000, 165465465, 132132])) == b'\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$' = BGPPAClusterList - Dissection -a = BGPPAClusterList('\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$') +a = BGPPAClusterList(b'\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$') a.cluster_list[0] == 150000 and a.cluster_list[1] == 165465465 and a.cluster_list[2] == 132132 @@ -501,38 +501,38 @@ a.cluster_list[0] == 150000 and a.cluster_list[1] == 165465465 and a.cluster_lis + BGPPAMPReachNLRI class tests = BGPPAMPReachNLRI - Instantiation -str(BGPPAMPReachNLRI()) == '\x00\x00\x00\x00\x00' +str(BGPPAMPReachNLRI()) == b'\x00\x00\x00\x00\x00' = BGPPAMPReachNLRI - Instantiation with specific values (1) -str(BGPPAMPReachNLRI(afi=2, safi=1, nh_addr_len=16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")])) == '\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' +str(BGPPAMPReachNLRI(afi=2, safi=1, nh_addr_len=16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")])) == b'\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' = BGPPAMPReachNLRI - Dissection (1) -a = BGPPAMPReachNLRI('\x00\x02\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xfe\x80\x00\x00\x00\x00\x00\x00\xc0\x02\x0b\xff\xfe~\x00\x00\x00@ \x01\r\xb8\x00\x02\x00\x02@ \x01\r\xb8\x00\x02\x00\x01@ \x01\r\xb8\x00\x02\x00\x00') +a = BGPPAMPReachNLRI(b'\x00\x02\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xfe\x80\x00\x00\x00\x00\x00\x00\xc0\x02\x0b\xff\xfe~\x00\x00\x00@ \x01\r\xb8\x00\x02\x00\x02@ \x01\r\xb8\x00\x02\x00\x01@ \x01\r\xb8\x00\x02\x00\x00') a.afi == 2 and a.safi == 1 and a.nh_addr_len == 32 and a.nh_v6_global == "2001:db8::2" and a.nh_v6_link_local == "fe80::c002:bff:fe7e:0" and a.reserved == 0 and a.nlri[0].prefix == "2001:db8:2:2::/64" and a.nlri[1].prefix == "2001:db8:2:1::/64" and a.nlri[2].prefix == "2001:db8:2::/64" = BGPPAMPReachNLRI - Dissection (2) -a = BGPPAMPReachNLRI('\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') -a.afi == 2 and a.safi == 1 and a.nh_addr_len == 32 and a.nh_v6_global == "fe80::fac0:100:15de:1581" and a.nh_v6_link_local == "fe80::fac0:100:15de:1581" and a.reserved == 0 and a.nlri[0].prefix == "400::/6" and a.nlri[1].prefix == "800::/5" and str(a.nlri[18]) == '`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff' and a.nlri[35].prefix == "200::/7" +a = BGPPAMPReachNLRI(b'\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') +a.afi == 2 and a.safi == 1 and a.nh_addr_len == 32 and a.nh_v6_global == "fe80::fac0:100:15de:1581" and a.nh_v6_link_local == "fe80::fac0:100:15de:1581" and a.reserved == 0 and a.nlri[0].prefix == "400::/6" and a.nlri[1].prefix == "800::/5" and str(a.nlri[18]) == b'`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff' and a.nlri[35].prefix == "200::/7" #############################Â BGPPAMPUnreachNLRI ############################# + BGPPAMPUnreachNLRI class tests = BGPPAMPUnreachNLRI - Instantiation -str(BGPPAMPUnreachNLRI()) == '\x00\x00\x00' +str(BGPPAMPUnreachNLRI()) == b'\x00\x00\x00' = BGPPAMPUnreachNLRI - Instantiation with specific values (1) -str(BGPPAMPUnreachNLRI(afi = 2, safi = 1)) == '\x00\x02\x01' +str(BGPPAMPUnreachNLRI(afi = 2, safi = 1)) == b'\x00\x02\x01' = BGPPAMPUnreachNLRI - Instantiation with specific values (2) -str(BGPPAMPUnreachNLRI(afi = 2, safi = 1, afi_safi_specific = BGPPAMPUnreachNLRI_IPv6(withdrawn_routes = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == '\x00\x02\x01@ \x01\r\xb8\x00\x02\x00\x00' +str(BGPPAMPUnreachNLRI(afi = 2, safi = 1, afi_safi_specific = BGPPAMPUnreachNLRI_IPv6(withdrawn_routes = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == b'\x00\x02\x01@ \x01\r\xb8\x00\x02\x00\x00' = BGPPAMPUnreachNLRI - Dissection (1) -a = BGPPAMPUnreachNLRI('\x00\x02\x01') +a = BGPPAMPUnreachNLRI(b'\x00\x02\x01') a.afi == 2 and a.safi == 1 = BGPPAMPUnreachNLRI - Dissection (2) -a = BGPPAMPUnreachNLRI('\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') +a = BGPPAMPUnreachNLRI(b'\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') a.afi == 2 and a.safi == 1 and a.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3" and a.afi_safi_specific.withdrawn_routes[11].prefix == "2001::/32" and a.afi_safi_specific.withdrawn_routes[23].prefix == "1000::/4" @@ -540,13 +540,13 @@ a.afi == 2 and a.safi == 1 and a.afi_safi_specific.withdrawn_routes[0].prefix == + BGPPAAS4Aggregator class tests = BGPPAAS4Aggregator - Instantiation -str(BGPPAAS4Aggregator()) == '\x00\x00\x00\x00\x00\x00\x00\x00' +str(BGPPAAS4Aggregator()) == b'\x00\x00\x00\x00\x00\x00\x00\x00' = BGPPAAS4Aggregator - Instantiation with specific values -str(BGPPAAS4Aggregator(aggregator_asn = 644566565, speaker_address = "192.0.2.1")) == '&kN%\xc0\x00\x02\x01' +str(BGPPAAS4Aggregator(aggregator_asn = 644566565, speaker_address = "192.0.2.1")) == b'&kN%\xc0\x00\x02\x01' = BGPPAAS4Aggregator - Dissection -a = BGPPAAS4Aggregator('&kN%\xc0\x00\x02\x01') +a = BGPPAAS4Aggregator(b'&kN%\xc0\x00\x02\x01') a.aggregator_asn == 644566565 and a.speaker_address == "192.0.2.1" @@ -554,20 +554,20 @@ a.aggregator_asn == 644566565 and a.speaker_address == "192.0.2.1" + BGPPathAttr class tests = BGPPathAttr - Instantiation -str(BGPPathAttr()) == '\x80\x00\x00' +str(BGPPathAttr()) == b'\x80\x00\x00' = BGPPathAttr - Instantiation with specific values (1) str(BGPPathAttr(type_code = 1, attribute = BGPPAOrigin(origin = 0))) = BGPPathAttr - Instantiation with specific values (2) -str(BGPPathAttr(type_code = 2, attribute = BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64501, 64501, 64501])]))) == '\x80\x02\x08\x02\x03\xfb\xf5\xfb\xf5\xfb\xf5' +str(BGPPathAttr(type_code = 2, attribute = BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64501, 64501, 64501])]))) == b'\x80\x02\x08\x02\x03\xfb\xf5\xfb\xf5\xfb\xf5' = BGPPathAttr - Instantiation with specific values (3) -str(BGPPathAttr(type_code = 14, attribute = BGPPAMPReachNLRI(afi = 2, safi = 1, nh_addr_len = 16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == '\x80\x0e\x1e\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' +str(BGPPathAttr(type_code = 14, attribute = BGPPAMPReachNLRI(afi = 2, safi = 1, nh_addr_len = 16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == b'\x80\x0e\x1e\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' = BGPPathAttr - Dissection (1) -a = BGPPathAttr('\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') +a = BGPPathAttr(b'\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') a.type_flags == 0x90 and a.type_code == 15 and a.attr_ext_len == 88 and a.attribute.afi == 2 and a.attribute.safi == 1 and a.attribute.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[1].prefix == "8000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[2].prefix == "a000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[3].prefix == "c000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[4].prefix == "e000::/4" and a.attribute.afi_safi_specific.withdrawn_routes[5].prefix == "f000::/5" and a.attribute.afi_safi_specific.withdrawn_routes[23].prefix == "1000::/4" @@ -575,11 +575,11 @@ a.type_flags == 0x90 and a.type_code == 15 and a.attr_ext_len == 88 and a.attrib + BGPUpdate class tests = BGPUpdate - Instantiation -str(BGPUpdate()) == '\x00\x00\x00\x00' +str(BGPUpdate()) == b'\x00\x00\x00\x00' = BGPUpdate - Dissection (1) bgp_module_conf.use_2_bytes_asn = True -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x000\x02\x00\x19\x18\xc0\xa8\x96\x18\x07\x07\x07\x18\xc63d\x18\xc0\xa8\x01\x19\x06\x06\x06\x00\x18\xc0\xa8\x1a\x00\x00') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x000\x02\x00\x19\x18\xc0\xa8\x96\x18\x07\x07\x07\x18\xc63d\x18\xc0\xa8\x01\x19\x06\x06\x06\x00\x18\xc0\xa8\x1a\x00\x00') assert(BGPHeader in m and BGPUpdate in m) assert(m.withdrawn_routes_len == 25) assert(m.withdrawn_routes[0].prefix == "192.168.150.0/24") @@ -588,7 +588,7 @@ assert(m.path_attr_len == 0) = BGPUpdate - Behave like a NEW speaker (RFC 6793) - Dissection (2) bgp_module_conf.use_2_bytes_asn = False -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x02\x00\x00\x00"@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xfa@\x03\x04\xc0\xa8\x10\x06\x80\x04\x04\x00\x00\x00\x00\xc0\x08\x04\xff\xff\xff\x01\x18\xc0\xa8\x01') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x02\x00\x00\x00"@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xfa@\x03\x04\xc0\xa8\x10\x06\x80\x04\x04\x00\x00\x00\x00\xc0\x08\x04\xff\xff\xff\x01\x18\xc0\xa8\x01') assert(BGPHeader in m and BGPUpdate in m) assert(m.path_attr[1].attribute.segments[0].segment_value == [64506]) assert(m.path_attr[4].attribute.community == 0xFFFFFF01) @@ -597,7 +597,7 @@ assert(m.nlri[0].prefix == "192.168.1.0/24") = BGPUpdate - Dissection (MP_REACH_NLRI) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xd8\x02\x00\x00\x00\xc1@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xf6\x90\x0e\x00\xb0\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xd8\x02\x00\x00\x00\xc1@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xf6\x90\x0e\x00\xb0\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') assert(BGPHeader in m and BGPUpdate in m) assert(m.path_attr[2].attribute.afi == 2) assert(m.path_attr[2].attribute.safi == 1) @@ -608,7 +608,7 @@ assert(m.path_attr[2].attribute.nlri[0].prefix == "400::/6") assert(m.nlri == []) = BGPUpdate - Dissection (MP_UNREACH_NLRI) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00s\x02\x00\x00\x00\\\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00s\x02\x00\x00\x00\\\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') assert(BGPHeader in m and BGPUpdate in m) assert(m.path_attr[0].attribute.afi == 2) assert(m.path_attr[0].attribute.safi == 1) @@ -620,18 +620,18 @@ assert(m.nlri == []) + BGPNotification class tests = BGPNotification - Instantiation -str(BGPNotification()) == '\x00\x00' +str(BGPNotification()) == b'\x00\x00' = BGPNotification - Dissection (Administratively Reset) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x15\x03\x06\x04') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x15\x03\x06\x04') m.type == BGP.NOTIFICATION_TYPE and m.error_code == 6 and m.error_subcode == 4 = BGPNotification - Dissection (Bad Peer AS) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x03\x02\x02\x00\x00') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x03\x02\x02\x00\x00') m.type == BGP.NOTIFICATION_TYPE and m.error_code == 2 and m.error_subcode == 2 = BGPNotification - Dissection (Attribute Flags Error) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x19\x03\x03\x04\x80\x01\x01\x00') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x19\x03\x03\x04\x80\x01\x01\x00') m.type == BGP.NOTIFICATION_TYPE and m.error_code == 3 and m.error_subcode == 4 @@ -639,18 +639,18 @@ m.type == BGP.NOTIFICATION_TYPE and m.error_code == 3 and m.error_subcode == 4 + BGPRouteRefresh class tests = BGPRouteRefresh - Instantiation -str(BGPRouteRefresh()) == '\x00\x01\x00\x01' +str(BGPRouteRefresh()) == b'\x00\x01\x00\x01' = BGPRouteRefresh - Instantiation with specific values -str(BGPRouteRefresh(afi = 1, safi = 1)) == '\x00\x01\x00\x01' +str(BGPRouteRefresh(afi = 1, safi = 1)) == b'\x00\x01\x00\x01' = BGPRouteRefresh - Dissection (1) -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x05\x00\x02\x00\x01') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x05\x00\x02\x00\x01') m.type == BGP.ROUTEREFRESH_TYPE and m.len == 23 and m.afi == 2 and m.subtype == 0 and m.safi == 1 = BGPRouteRefresh - Dissection (2) - With ORFs -m = BGP('\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00.\x05\x00\x01\x00\x01\x01\x80\x00\x13 \x00\x00\x00\x05\x18\x18\x15\x01\x01\x00\x00\x00\x00\x00\n\x00 \x00') +m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00.\x05\x00\x01\x00\x01\x01\x80\x00\x13 \x00\x00\x00\x05\x18\x18\x15\x01\x01\x00\x00\x00\x00\x00\n\x00 \x00') assert(m.type == BGP.ROUTEREFRESH_TYPE) assert(m.len == 46) assert(m.afi == 1) diff --git a/scapy/contrib/carp.py b/scapy/contrib/carp.py index aba858fcef49844ff9468600ecef09d2f5f91bbe..17fc37dfad9deab27f75785b7a266a2fc05a9f25 100644 --- a/scapy/contrib/carp.py +++ b/scapy/contrib/carp.py @@ -34,7 +34,7 @@ class CARP(Packet): return pkt -def build_hmac_sha1(pkt, pw = '\0' * 20, ip4l=None, ip6l=None): +def build_hmac_sha1(pkt, pw = b'\0' * 20, ip4l=None, ip6l=None): if ip4l is None: ip4l = [] if ip6l is None: @@ -45,7 +45,7 @@ def build_hmac_sha1(pkt, pw = '\0' * 20, ip4l=None, ip6l=None): p = pkt[CARP] h = hmac.new(pw, digestmod = hashlib.sha1) # XXX: this is a dirty hack. it needs to pack version and type into a single 8bit field - h.update('\x21') + h.update(b'\x21') # XXX: mac addy if different from special link layer. comes before vhid h.update(struct.pack('!B', p.vhid)) diff --git a/scapy/contrib/cdp.py b/scapy/contrib/cdp.py index 6730ea7544f5d39079d27dccf64cee91a0ac7824..93d1ed868507ca6b49a4860ef659328e3e4d43df 100644 --- a/scapy/contrib/cdp.py +++ b/scapy/contrib/cdp.py @@ -110,8 +110,8 @@ class CDPMsgDeviceID(CDPMsgGeneric): type = 0x0001 _cdp_addr_record_ptype = {0x01: "NLPID", 0x02: "802.2"} -_cdp_addrrecord_proto_ip = "\xcc" -_cdp_addrrecord_proto_ipv6 = "\xaa\xaa\x03\x00\x00\x00\x86\xdd" +_cdp_addrrecord_proto_ip = b"\xcc" +_cdp_addrrecord_proto_ipv6 = b"\xaa\xaa\x03\x00\x00\x00\x86\xdd" class CDPAddrRecord(Packet): name = "CDP Address" @@ -252,7 +252,7 @@ class CDPMsgVoIPVLANQuery(CDPMsgGeneric): name = "VoIP VLAN Query" type = 0x000f fields_desc = [ XShortEnumField("type", 0x000f, _cdp_tlv_types), - ShortField("len", 7), + ShortField("len", 7), XByteField("unknown1", 0), ShortField("vlan", 1), # TLV length (len) - 2 (type) - 2 (len) - 1 (unknown1) - 2 (vlan) @@ -314,10 +314,10 @@ class _CDPChecksum: packet should not be altered.""" if len(pkt) % 2: last_chr = pkt[-1] - if last_chr <= '\x80': - return pkt[:-1] + '\x00' + last_chr + if last_chr <= b'\x80': + return pkt[:-1] + b'\x00' + last_chr else: - return pkt[:-1] + '\xff' + chr(ord(last_chr) - 1) + return pkt[:-1] + b'\xff' + chr(ord(last_chr) - 1) else: return pkt diff --git a/scapy/contrib/cdp.uts b/scapy/contrib/cdp.uts index bf40225d3702bb960d451661c6e2e48a0bf67ba6..b70c43ae6c8b5abc621a676d1e824c8156bd5467 100644 --- a/scapy/contrib/cdp.uts +++ b/scapy/contrib/cdp.uts @@ -6,7 +6,7 @@ + CDP = CDPv2 - Dissection (1) -s = '\x02\xb4\x8c\xfa\x00\x01\x00\x0cmyswitch\x00\x02\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x00\xfd\x00\x03\x00\x13FastEthernet0/1\x00\x04\x00\x08\x00\x00\x00(\x00\x05\x01\x14Cisco Internetwork Operating System Software \nIOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWARE (fc1)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2010 by cisco Systems, Inc.\nCompiled Tue 26-Oct-10 10:35 by nburra\x00\x06\x00\x15cisco WS-C2950-12\x00\x08\x00$\x00\x00\x0c\x01\x12\x00\x00\x00\x00\xff\xff\xff\xff\x01\x02!\xff\x00\x00\x00\x00\x00\x00\x00\x0b\xbe\x18\x9a@\xff\x00\x00\x00\t\x00\x0cMYDOMAIN\x00\n\x00\x06\x00\x01\x00\x0b\x00\x05\x01\x00\x0e\x00\x07\x01\x00\n\x00\x12\x00\x05\x00\x00\x13\x00\x05\x00\x00\x16\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x00\xfd' +s = b'\x02\xb4\x8c\xfa\x00\x01\x00\x0cmyswitch\x00\x02\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x00\xfd\x00\x03\x00\x13FastEthernet0/1\x00\x04\x00\x08\x00\x00\x00(\x00\x05\x01\x14Cisco Internetwork Operating System Software \nIOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWARE (fc1)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2010 by cisco Systems, Inc.\nCompiled Tue 26-Oct-10 10:35 by nburra\x00\x06\x00\x15cisco WS-C2950-12\x00\x08\x00$\x00\x00\x0c\x01\x12\x00\x00\x00\x00\xff\xff\xff\xff\x01\x02!\xff\x00\x00\x00\x00\x00\x00\x00\x0b\xbe\x18\x9a@\xff\x00\x00\x00\t\x00\x0cMYDOMAIN\x00\n\x00\x06\x00\x01\x00\x0b\x00\x05\x01\x00\x0e\x00\x07\x01\x00\n\x00\x12\x00\x05\x00\x00\x13\x00\x05\x00\x00\x16\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x00\xfd' cdpv2 = CDPv2_HDR(s) assert(cdpv2.vers == 2) assert(cdpv2.ttl == 180) @@ -37,7 +37,7 @@ assert(cdpv2[CDPMsgUntrustedPortCoS].len == 5) assert(cdpv2[CDPMsgUntrustedPortCoS].untrusted_port_cos == 0x0) = CDPv2 - Dissection (2) -s = '\x02\xb4\xd7\xdb\x00\x01\x00\x13SIP001122334455\x00\x02\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x01!\x00\x03\x00\nPort 1\x00\x04\x00\x08\x00\x00\x00\x10\x00\x05\x00\x10P003-08-2-00\x00\x06\x00\x17Cisco IP Phone 7960\x00\x0f\x00\x08 \x02\x00\x01\x00\x0b\x00\x05\x01\x00\x10\x00\x06\x18\x9c' +s = b'\x02\xb4\xd7\xdb\x00\x01\x00\x13SIP001122334455\x00\x02\x00\x11\x00\x00\x00\x01\x01\x01\xcc\x00\x04\xc0\xa8\x01!\x00\x03\x00\nPort 1\x00\x04\x00\x08\x00\x00\x00\x10\x00\x05\x00\x10P003-08-2-00\x00\x06\x00\x17Cisco IP Phone 7960\x00\x0f\x00\x08 \x02\x00\x01\x00\x0b\x00\x05\x01\x00\x10\x00\x06\x18\x9c' cdpv2 = CDPv2_HDR(s) assert(cdpv2.vers == 2) assert(cdpv2.ttl == 180) diff --git a/scapy/contrib/coap.py b/scapy/contrib/coap.py index fbd67d20eb2a04aedce5ec9a687192ed541cec8f..aa2a1f6f719703213c75b2794d5e8bb9f9c37ab9 100644 --- a/scapy/contrib/coap.py +++ b/scapy/contrib/coap.py @@ -145,7 +145,7 @@ class _CoAPOpt(Packet): return Packet.do_build(self) def guess_payload_class(self, payload): - if payload[0] != '\xff': + if payload[0] != b'\xff': return _CoAPOpt else: return Packet.guess_payload_class(self, payload) @@ -206,8 +206,8 @@ class _CoAPPaymark(StrField): return s[u:], m def m2i(self, pkt, x): - if len(x) > 0 and x[0] == '\xff': - return 1, '\xff' + if len(x) > 0 and x[0] == b'\xff': + return 1, b'\xff' return 0, ''; def i2m(self, pkt, x): diff --git a/scapy/contrib/coap.uts b/scapy/contrib/coap.uts index 236a30261e33fb9389f7f5184ac9e8cfe55a8014..08f470d35a5dbca662711bfda2bf853aa1e7a515 100644 --- a/scapy/contrib/coap.uts +++ b/scapy/contrib/coap.uts @@ -6,14 +6,14 @@ from scapy.contrib.coap import * + Test CoAP = CoAP default values -assert(str(CoAP()) == '\x40\x00\x00\x00') +assert(str(CoAP()) == b'\x40\x00\x00\x00') = Token length calculation p = CoAP(token='foobar') assert(CoAP(str(p)).tkl == 6) = CON GET dissect -p = CoAP('\x40\x01\xd9\xe1\xbb\x2e\x77\x65\x6c\x6c\x2d\x6b\x6e\x6f\x77\x6e\x04\x63\x6f\x72\x65') +p = CoAP(b'\x40\x01\xd9\xe1\xbb\x2e\x77\x65\x6c\x6c\x2d\x6b\x6e\x6f\x77\x6e\x04\x63\x6f\x72\x65') assert(p.code == 1) assert(p.ver == 1) assert(p.tkl == 0) @@ -24,16 +24,16 @@ assert(p.type == 0) assert(p.options == [('Uri-Path', '.well-known'), ('Uri-Path', 'core')]) = Extended option delta -assert(str(CoAP(options=[("Uri-Query", "query")])) == '\x40\x00\x00\x00\xd5\x02\x71\x75\x65\x72\x79') +assert(str(CoAP(options=[("Uri-Query", "query")])) == b'\x40\x00\x00\x00\xd5\x02\x71\x75\x65\x72\x79') = Extended option length -assert(str(CoAP(options=[("Location-Path", 'x' * 280)])) == '\x40\x00\x00\x00\x8e\x0b\x00' + '\x78' * 280) +assert(str(CoAP(options=[("Location-Path", 'x' * 280)])) == b'\x40\x00\x00\x00\x8e\x0b\x00' + b'\x78' * 280) = Options should be ordered by option number -assert(str(CoAP(options=[("Uri-Query", "b"),("Uri-Path","a")])) == '\x40\x00\x00\x00\xb1\x61\x41\x62') +assert(str(CoAP(options=[("Uri-Query", "b"),("Uri-Path","a")])) == b'\x40\x00\x00\x00\xb1\x61\x41\x62') = Options of the same type should not be reordered -assert(str(CoAP(options=[("Uri-Path", "b"),("Uri-Path","a")])) == '\x40\x00\x00\x00\xb1\x62\x01\x61') +assert(str(CoAP(options=[("Uri-Path", "b"),("Uri-Path","a")])) == b'\x40\x00\x00\x00\xb1\x62\x01\x61') + Test layer binding = Destination port @@ -41,17 +41,17 @@ p = UDP()/CoAP() assert(p[UDP].dport == 5683) = Source port -s = '\x16\x33\xa0\xa4\x00\x78\xfe\x8b\x60\x45\xd9\xe1\xc1\x28\xff\x3c\x2f\x3e\x3b\x74\x69\x74\x6c\x65\x3d\x22\x47\x65' \ - '\x6e\x65\x72\x61\x6c\x20\x49\x6e\x66\x6f\x22\x3b\x63\x74\x3d\x30\x2c\x3c\x2f\x74\x69\x6d\x65\x3e\x3b\x69\x66\x3d' \ - '\x22\x63\x6c\x6f\x63\x6b\x22\x3b\x72\x74\x3d\x22\x54\x69\x63\x6b\x73\x22\x3b\x74\x69\x74\x6c\x65\x3d\x22\x49\x6e' \ - '\x74\x65\x72\x6e\x61\x6c\x20\x43\x6c\x6f\x63\x6b\x22\x3b\x63\x74\x3d\x30\x3b\x6f\x62\x73\x2c\x3c\x2f\x61\x73\x79' \ - '\x6e\x63\x3e\x3b\x63\x74\x3d\x30' +s = b'\x16\x33\xa0\xa4\x00\x78\xfe\x8b\x60\x45\xd9\xe1\xc1\x28\xff\x3c\x2f\x3e\x3b\x74\x69\x74\x6c\x65\x3d\x22\x47\x65' \ + b'\x6e\x65\x72\x61\x6c\x20\x49\x6e\x66\x6f\x22\x3b\x63\x74\x3d\x30\x2c\x3c\x2f\x74\x69\x6d\x65\x3e\x3b\x69\x66\x3d' \ + b'\x22\x63\x6c\x6f\x63\x6b\x22\x3b\x72\x74\x3d\x22\x54\x69\x63\x6b\x73\x22\x3b\x74\x69\x74\x6c\x65\x3d\x22\x49\x6e' \ + b'\x74\x65\x72\x6e\x61\x6c\x20\x43\x6c\x6f\x63\x6b\x22\x3b\x63\x74\x3d\x30\x3b\x6f\x62\x73\x2c\x3c\x2f\x61\x73\x79' \ + b'\x6e\x63\x3e\x3b\x63\x74\x3d\x30' assert(CoAP in UDP(s)) = building with a text/plain payload -p = CoAP(ver = 1, type = 0, code = 0x42, msg_id = 0xface, options=[("Content-Format", "\x00")], paymark = "\xff") -p /= Raw("\xde\xad\xbe\xef") -assert(str(p) == '\x40\x42\xfa\xce\xc1\x00\xff\xde\xad\xbe\xef') +p = CoAP(ver = 1, type = 0, code = 0x42, msg_id = 0xface, options=[("Content-Format", b"\x00")], paymark = b"\xff") +p /= Raw(b"\xde\xad\xbe\xef") +assert(str(p) == b'\x40\x42\xfa\xce\xc1\x00\xff\xde\xad\xbe\xef') = dissection with a text/plain payload p = CoAP(str(p)) @@ -60,4 +60,4 @@ assert(p.type == 0) assert(p.code == 0x42) assert(p.msg_id == 0xface) assert(isinstance(p.payload, Raw)) -assert(p.payload.load == '\xde\xad\xbe\xef') +assert(p.payload.load == b'\xde\xad\xbe\xef') diff --git a/scapy/contrib/dtp.py b/scapy/contrib/dtp.py index d367d5a9e9a5916ec7185f3f9a233ec012dd99d1..9996118aa0a91c1d1e5d53dae9ad078615c34130 100644 --- a/scapy/contrib/dtp.py +++ b/scapy/contrib/dtp.py @@ -63,21 +63,21 @@ class DTPDomain(DtpGenericTlv): name = "DTP Domain" fields_desc = [ ShortField("type", 1), FieldLenField("length", None, "domain", adjust=lambda pkt,x:x + 4), - StrLenField("domain", "\x00", length_from=lambda pkt:pkt.length - 4) + StrLenField("domain", b"\x00", length_from=lambda pkt:pkt.length - 4) ] class DTPStatus(DtpGenericTlv): name = "DTP Status" fields_desc = [ ShortField("type", 2), FieldLenField("length", None, "status", adjust=lambda pkt,x:x + 4), - StrLenField("status", "\x03", length_from=lambda pkt:pkt.length - 4) + StrLenField("status", b"\x03", length_from=lambda pkt:pkt.length - 4) ] class DTPType(DtpGenericTlv): name = "DTP Type" fields_desc = [ ShortField("type", 3), FieldLenField("length", None, "dtptype", adjust=lambda pkt,x:x + 4), - StrLenField("dtptype", "\xa5", length_from=lambda pkt:pkt.length - 4) + StrLenField("dtptype", b"\xa5", length_from=lambda pkt:pkt.length - 4) ] class DTPNeighbor(DtpGenericTlv): diff --git a/scapy/contrib/eigrp.py b/scapy/contrib/eigrp.py index a92782d5067f59d000b5284a9773989987869dbf..55b48f8d4f14846f24590babc4e376daf7a525d4 100644 --- a/scapy/contrib/eigrp.py +++ b/scapy/contrib/eigrp.py @@ -80,11 +80,11 @@ class EigrpIPField(StrField, IPField): l = self.length_from(pkt) if l <= 8: - x += "\x00\x00\x00" + x += b"\x00\x00\x00" elif l <= 16: - x += "\x00\x00" + x += b"\x00\x00" elif l <= 24: - x += "\x00" + x += b"\x00" return inet_ntoa(x) @@ -151,7 +151,7 @@ class EigrpIP6Field(StrField, IP6Field): if l > 128: warning("EigrpIP6Field: Prefix length is > 128. Dissection of this packet will fail") else: - pad = "\x00" * (16 - prefixlen) + pad = b"\x00" * (16 - prefixlen) x += pad return inet_ntop(socket.AF_INET6, x) @@ -181,7 +181,7 @@ class EIGRPGeneric(Packet): name = "EIGRP Generic TLV" fields_desc = [ XShortField("type", 0x0000), FieldLenField("len", None, "value", "!H", adjust=lambda pkt,x: x + 4), - StrLenField("value", "\x00", length_from=lambda pkt: pkt.len - 4)] + StrLenField("value", b"\x00", length_from=lambda pkt: pkt.len - 4)] def guess_payload_class(self, p): return conf.padding_layer @@ -211,7 +211,7 @@ class EIGRPAuthData(EIGRPGeneric): ShortEnumField("authtype", 2, {2 : "MD5"}), ShortField("keysize", None), IntField("keyid", 1), - StrFixedLenField("nullpad", "\x00" * 12, 12), + StrFixedLenField("nullpad", b"\x00" * 12, 12), StrLenField("authdata", RandString(16), length_from=lambda pkt: pkt.keysize) ] diff --git a/scapy/contrib/eigrp.uts b/scapy/contrib/eigrp.uts index c19a56b7db419f8f024bf98c185a43a18418eb2d..451b32200c70b6e1c449664727a11d80d15a0fd3 100644 --- a/scapy/contrib/eigrp.uts +++ b/scapy/contrib/eigrp.uts @@ -61,43 +61,43 @@ f.i2len(None, "") == 16 = EIGRPGuessPayloadClass function: Return Parameters TLV from scapy.contrib.eigrp import _EIGRPGuessPayloadClass -isinstance(_EIGRPGuessPayloadClass("\x00\x01"), EIGRPParam) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x01"), EIGRPParam) = EIGRPGuessPayloadClass function: Return Authentication Data TLV -isinstance(_EIGRPGuessPayloadClass("\x00\x02"), EIGRPAuthData) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x02"), EIGRPAuthData) = EIGRPGuessPayloadClass function: Return Sequence TLV -isinstance(_EIGRPGuessPayloadClass("\x00\x03"), EIGRPSeq) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x03"), EIGRPSeq) = EIGRPGuessPayloadClass function: Return Software Version TLV -isinstance(_EIGRPGuessPayloadClass("\x00\x04"), EIGRPSwVer) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x04"), EIGRPSwVer) = EIGRPGuessPayloadClass function: Return Next Multicast Sequence TLV -isinstance(_EIGRPGuessPayloadClass("\x00\x05"), EIGRPNms) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x05"), EIGRPNms) = EIGRPGuessPayloadClass function: Return Stub Router TLV -isinstance(_EIGRPGuessPayloadClass("\x00\x06"), EIGRPStub) +isinstance(_EIGRPGuessPayloadClass(b"\x00\x06"), EIGRPStub) = EIGRPGuessPayloadClass function: Return Internal Route TLV -isinstance(_EIGRPGuessPayloadClass("\x01\x02"), EIGRPIntRoute) +isinstance(_EIGRPGuessPayloadClass(b"\x01\x02"), EIGRPIntRoute) = EIGRPGuessPayloadClass function: Return External Route TLV -isinstance(_EIGRPGuessPayloadClass("\x01\x03"), EIGRPExtRoute) +isinstance(_EIGRPGuessPayloadClass(b"\x01\x03"), EIGRPExtRoute) = EIGRPGuessPayloadClass function: Return IPv6 Internal Route TLV -isinstance(_EIGRPGuessPayloadClass("\x04\x02"), EIGRPv6IntRoute) +isinstance(_EIGRPGuessPayloadClass(b"\x04\x02"), EIGRPv6IntRoute) = EIGRPGuessPayloadClass function: Return IPv6 External Route TLV -isinstance(_EIGRPGuessPayloadClass("\x04\x03"), EIGRPv6ExtRoute) +isinstance(_EIGRPGuessPayloadClass(b"\x04\x03"), EIGRPv6ExtRoute) = EIGRPGuessPayloadClass function: Return EIGRPGeneric -isinstance(_EIGRPGuessPayloadClass("\x23\x42"), EIGRPGeneric) +isinstance(_EIGRPGuessPayloadClass(b"\x23\x42"), EIGRPGeneric) + TLV List = EIGRP parameters and software version p = IP()/EIGRP(tlvlist=[EIGRPParam()/EIGRPSwVer()]) -s = '\x45\x00\x00\x3C\x00\x01\x00\x00\x40\x58\x7C\x67\x7F\x00\x00\x01\x7F\x00\x00\x01\x02\x05\xEE\x6C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\x01\x00\x0C\x01\x00\x01\x00\x00\x00\x00\x0F\x00\x04\x00\x08\x0C\x00\x01\x02' +s = b'\x45\x00\x00\x3C\x00\x01\x00\x00\x40\x58\x7C\x67\x7F\x00\x00\x01\x7F\x00\x00\x01\x02\x05\xEE\x6C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\x01\x00\x0C\x01\x00\x01\x00\x00\x00\x00\x0F\x00\x04\x00\x08\x0C\x00\x01\x02' str(p) == s = EIGRP internal route length field @@ -196,9 +196,9 @@ p[EIGRPExtRoute:2].mtu == 23 + Authentication Data TLV = Verify keysize calculation -p = IP()/EIGRP(tlvlist=[EIGRPAuthData(authdata="\xaa\xbb\xcc")]) -p[EIGRPAuthData].build()[6:8] == "\x00\x03" +p = IP()/EIGRP(tlvlist=[EIGRPAuthData(authdata=b"\xaa\xbb\xcc")]) +p[EIGRPAuthData].build()[6:8] == b"\x00\x03" = Verify length calculation -p = IP()/EIGRP(tlvlist=[EIGRPAuthData(authdata="\xaa\xbb\xcc\xdd")]) -p[EIGRPAuthData].build()[2:4] == "\x00\x1c" +p = IP()/EIGRP(tlvlist=[EIGRPAuthData(authdata=b"\xaa\xbb\xcc\xdd")]) +p[EIGRPAuthData].build()[2:4] == b"\x00\x1c" diff --git a/scapy/contrib/gtp.uts b/scapy/contrib/gtp.uts index 661f03f32b61aed13b9310100154be0adf9152af..a23fd413c98b37a6a1105d8958ddefd586ad1e60 100644 --- a/scapy/contrib/gtp.uts +++ b/scapy/contrib/gtp.uts @@ -11,7 +11,7 @@ gtp.dport == 2123 and gtp.teid == 2807 and len(gtp.IE_list) == 5 = GTPCreatePDPContextRequest(), basic dissection random.seed(0x2807) -str(gtp) == "E\x00\x00O\x00\x01\x00\x00@\x11|\x9b\x7f\x00\x00\x01\x7f\x00\x00\x01\x08K\x08K\x00;{N2\x10\x00+\x00\x00\n\xf7\xd2y\x00\x00\x10\xf8>\x14\x05\x14\t\x85\x00\x04\xa6A\xd8+\x85\x00\x04z\xafnt\x87\x00\x0fxKbPaePK9oq0pb5" +str(gtp) == b"E\x00\x00O\x00\x01\x00\x00@\x11|\x9b\x7f\x00\x00\x01\x7f\x00\x00\x01\x08K\x08K\x00;{N2\x10\x00+\x00\x00\n\xf7\xd2y\x00\x00\x10\xf8>\x14\x05\x14\t\x85\x00\x04\xa6A\xd8+\x85\x00\x04z\xafnt\x87\x00\x0fxKbPaePK9oq0pb5" = GTPV1UpdatePDPContextRequest(), dissect h = "3333333333332222222222228100a38408004588006800000000fd1134820a2a00010a2a00024aa5084b005408bb32120044ed99aea9386f0000100000530514058500040a2a00018500040a2a000187000c0213921f739680fe74f2ffff94000130970001019800080112f41004d204d29900024000b6000101" @@ -167,12 +167,12 @@ ie.ietype == 131 and ie.APN == 'aaaaaa' h = "333333333333222222222222810083840800458800c300000000fc1184e50a2a00010a2a00024a4d084b00af41993210009fdef90e15440900000202081132547600000332f42004d27b0ffc10c29998b81145c6c9ee14051a0a00800002f1218300070661616161616184001d80c02306010100060000802110010100108106000000008306000000008500040a2a00018500040a2a00018600079111111111111187000d0213621f73967373741affff0094000120970001029800080032f42004d204d299000240009a0008111111111111000081182fb2" gtp = Ether(h.decode('hex')) ie = gtp.IE_list[9] -ie.ietype == 132 and ie.Protocol_Configuration == '\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00' +ie.ietype == 132 and ie.Protocol_Configuration == b'\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00' = IE_ProtocolConfigurationOptions(), basic instantiation ie = IE_ProtocolConfigurationOptions( - length=29, Protocol_Configuration='\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00') -ie.ietype == 132 and ie.Protocol_Configuration == '\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00' + length=29, Protocol_Configuration=b'\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00') +ie.ietype == 132 and ie.Protocol_Configuration == b'\x80\xc0#\x06\x01\x01\x00\x06\x00\x00\x80!\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00\x83\x06\x00\x00\x00\x00' = IE_GSNAddress(), dissect h = "3333333333332222222222228100838408004588005400000000fd1182850a2a00010a2a0002084b084b00406b463213003031146413c18000000180109181ba027fcf701a8c8500040a2a00018500040a2a000187000f0213921f7396d1fe7482ffff004a00f7a71e0a" diff --git a/scapy/contrib/http2.uts b/scapy/contrib/http2.uts index 58cd91affdcf19d4e4002e92117d627cfebfd498..cc766244c12476a17dc0215ac4d35efbffa414b6 100644 --- a/scapy/contrib/http2.uts +++ b/scapy/contrib/http2.uts @@ -34,51 +34,51 @@ assert(f.any2i(None, 3) == 3) assert(f.any2i(None, 1<<5) == 1<<5) assert(f.any2i(None, 1<<16) == 1<<16) f = h2.UVarIntField('value', 0, 8) -assert(f.any2i(None, '\x1E') == 30) +assert(f.any2i(None, b'\x1E') == 30) = HTTP/2 UVarIntField.m2i on full byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 8) -assert(f.m2i(None, '\x00') == 0) -assert(f.m2i(None, '\x03') == 3) -assert(f.m2i(None, '\xFE') == 254) -assert(f.m2i(None, '\xFF\x00') == 255) -assert(f.m2i(None, '\xFF\xFF\x03') == 766) #0xFF + (0xFF ^ 0x80) + (3<<7) +assert(f.m2i(None, b'\x00') == 0) +assert(f.m2i(None, b'\x03') == 3) +assert(f.m2i(None, b'\xFE') == 254) +assert(f.m2i(None, b'\xFF\x00') == 255) +assert(f.m2i(None, b'\xFF\xFF\x03') == 766) #0xFF + (0xFF ^ 0x80) + (3<<7) = HTTP/2 UVarIntField.m2i on partial byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 5) -assert(f.m2i(None, ('\x00', 3)) == 0) -assert(f.m2i(None, ('\x03', 3)) == 3) -assert(f.m2i(None, ('\x1e', 3)) == 30) -assert(f.m2i(None, ('\x1f\x00', 3)) == 31) -assert(f.m2i(None, ('\x1f\xe1\xff\x03', 3)) == 65536) +assert(f.m2i(None, (b'\x00', 3)) == 0) +assert(f.m2i(None, (b'\x03', 3)) == 3) +assert(f.m2i(None, (b'\x1e', 3)) == 30) +assert(f.m2i(None, (b'\x1f\x00', 3)) == 31) +assert(f.m2i(None, (b'\x1f\xe1\xff\x03', 3)) == 65536) = HTTP/2 UVarIntField.getfield on full byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 8) -r = f.getfield(None, '\x00\x00') -assert(r[0] == '\x00') +r = f.getfield(None, b'\x00\x00') +assert(r[0] == b'\x00') assert(r[1] == 0) -r = f.getfield(None, '\x03\x00') -assert(r[0] == '\x00') +r = f.getfield(None, b'\x03\x00') +assert(r[0] == b'\x00') assert(r[1] == 3) -r = f.getfield(None, '\xFE\x00') -assert(r[0] == '\x00') +r = f.getfield(None, b'\xFE\x00') +assert(r[0] == b'\x00') assert(r[1] == 254) -r = f.getfield(None, '\xFF\x00\x00') -assert(r[0] == '\x00') +r = f.getfield(None, b'\xFF\x00\x00') +assert(r[0] == b'\x00') assert(r[1] == 255) -r = f.getfield(None, '\xFF\xFF\x03\x00') -assert(r[0] == '\x00') +r = f.getfield(None, b'\xFF\xFF\x03\x00') +assert(r[0] == b'\x00') assert(r[1] == 766) = HTTP/2 UVarIntField.getfield on partial byte @@ -86,67 +86,67 @@ assert(r[1] == 766) f = h2.UVarIntField('value', 0, 5) -r = f.getfield(None, ('\x00\x00', 3)) -assert(r[0] == '\x00') +r = f.getfield(None, (b'\x00\x00', 3)) +assert(r[0] == b'\x00') assert(r[1] == 0) -r = f.getfield(None, ('\x03\x00', 3)) -assert(r[0] == '\x00') +r = f.getfield(None, (b'\x03\x00', 3)) +assert(r[0] == b'\x00') assert(r[1] == 3) -r = f.getfield(None, ('\x1e\x00', 3)) -assert(r[0] == '\x00') +r = f.getfield(None, (b'\x1e\x00', 3)) +assert(r[0] == b'\x00') assert(r[1] == 30) -r = f.getfield(None, ('\x1f\x00\x00', 3)) -assert(r[0] == '\x00') +r = f.getfield(None, (b'\x1f\x00\x00', 3)) +assert(r[0] == b'\x00') assert(r[1] == 31) -r = f.getfield(None, ('\x1f\xe1\xff\x03\x00', 3)) -assert(r[0] == '\x00') +r = f.getfield(None, (b'\x1f\xe1\xff\x03\x00', 3)) +assert(r[0] == b'\x00') assert(r[1] == 65536) = HTTP/2 UVarIntField.i2m on full byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 8) -assert(f.i2m(None, 0) == '\x00') -assert(f.i2m(None, 3) == '\x03') -assert(f.i2m(None, 254).lower() == '\xfe') -assert(f.i2m(None, 255).lower() == '\xff\x00') -assert(f.i2m(None, 766).lower() == '\xff\xff\x03') +assert(f.i2m(None, 0) == b'\x00') +assert(f.i2m(None, 3) == b'\x03') +assert(f.i2m(None, 254).lower() == b'\xfe') +assert(f.i2m(None, 255).lower() == b'\xff\x00') +assert(f.i2m(None, 766).lower() == b'\xff\xff\x03') = HTTP/2 UVarIntField.i2m on partial byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 5) -assert(f.i2m(None, 0) == '\x00') -assert(f.i2m(None, 3) == '\x03') -assert(f.i2m(None, 30).lower() == '\x1e') -assert(f.i2m(None, 31).lower() == '\x1f\x00') -assert(f.i2m(None, 65536).lower() == '\x1f\xe1\xff\x03') +assert(f.i2m(None, 0) == b'\x00') +assert(f.i2m(None, 3) == b'\x03') +assert(f.i2m(None, 30).lower() == b'\x1e') +assert(f.i2m(None, 31).lower() == b'\x1f\x00') +assert(f.i2m(None, 65536).lower() == b'\x1f\xe1\xff\x03') = HTTP/2 UVarIntField.addfield on full byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 8) -assert(f.addfield(None, 'toto', 0) == 'toto\x00') -assert(f.addfield(None, 'toto', 3) == 'toto\x03') -assert(f.addfield(None, 'toto', 254).lower() == 'toto\xfe') -assert(f.addfield(None, 'toto', 255).lower() == 'toto\xff\x00') -assert(f.addfield(None, 'toto', 766).lower() == 'toto\xff\xff\x03') +assert(f.addfield(None, 'toto', 0) == b'toto\x00') +assert(f.addfield(None, 'toto', 3) == b'toto\x03') +assert(f.addfield(None, 'toto', 254).lower() == b'toto\xfe') +assert(f.addfield(None, 'toto', 255).lower() == b'toto\xff\x00') +assert(f.addfield(None, 'toto', 766).lower() == b'toto\xff\xff\x03') = HTTP/2 UVarIntField.addfield on partial byte ~ http2 frame field uvarintfield f = h2.UVarIntField('value', 0, 5) -assert(f.addfield(None, ('toto', 3, 4), 0) == 'toto\x80') -assert(f.addfield(None, ('toto', 3, 4), 3) == 'toto\x83') -assert(f.addfield(None, ('toto', 3, 4), 30).lower() == 'toto\x9e') -assert(f.addfield(None, ('toto', 3, 4), 31).lower() == 'toto\x9f\x00') -assert(f.addfield(None, ('toto', 3, 4), 65536).lower() == 'toto\x9f\xe1\xff\x03') +assert(f.addfield(None, ('toto', 3, 4), 0) == b'toto\x80') +assert(f.addfield(None, ('toto', 3, 4), 3) == b'toto\x83') +assert(f.addfield(None, ('toto', 3, 4), 30).lower() == b'toto\x9e') +assert(f.addfield(None, ('toto', 3, 4), 31).lower() == b'toto\x9f\x00') +assert(f.addfield(None, ('toto', 3, 4), 65536).lower() == b'toto\x9f\xe1\xff\x03') = HTTP/2 UVarIntField.i2len on full byte ~ http2 frame field uvarintfield @@ -184,11 +184,11 @@ class TrivialPacket(Packet): StrField('data', '') ] -assert(f.i2m(TrivialPacket(data='a'*5), None) == '\x05') -assert(f.i2m(TrivialPacket(data='a'*255), None).lower() == '\xff\x00') -assert(f.i2m(TrivialPacket(data='a'), 2) == '\x02') -assert(f.i2m(None, 2) == '\x02') -assert(f.i2m(None, 0) == '\x00') +assert(f.i2m(TrivialPacket(data='a'*5), None) == b'\x05') +assert(f.i2m(TrivialPacket(data='a'*255), None).lower() == b'\xff\x00') +assert(f.i2m(TrivialPacket(data='a'), 2) == b'\x02') +assert(f.i2m(None, 2) == b'\x02') +assert(f.i2m(None, 0) == b'\x00') = HTTP/2 FieldUVarLenField.i2m with adjustment ~ http2 frame field fielduvarlenfield @@ -201,10 +201,10 @@ class TrivialPacket(Packet): ] f = h2.FieldUVarLenField('value', None, 8, length_of='data', adjust=lambda x: x-1) -assert(f.i2m(TrivialPacket(data='a'*5), None) == '\x04') -assert(f.i2m(TrivialPacket(data='a'*255), None).lower() == '\xfe') +assert(f.i2m(TrivialPacket(data='a'*5), None) == b'\x04') +assert(f.i2m(TrivialPacket(data='a'*255), None).lower() == b'\xfe') #Adjustement does not affect non-None value! -assert(f.i2m(TrivialPacket(data='a'*3), 2) == '\x02') +assert(f.i2m(TrivialPacket(data='a'*3), 2) == b'\x02') + HTTP/2 HPackZString Test Suite @@ -214,29 +214,29 @@ assert(f.i2m(TrivialPacket(data='a'*3), 2) == '\x02') string = 'Test' s = h2.HPackZString(string) assert(len(s) == 3) -assert(str(s) == "\xdeT'") +assert(str(s) == b"\xdeT'") assert(s.origin() == string) string = 'a'*65535 s = h2.HPackZString(string) assert(len(s) == 40960) -assert(str(s) == ('\x18\xc61\x8cc' * 8191) + '\x18\xc61\x8c\x7f') +assert(str(s) == (b'\x18\xc61\x8cc' * 8191) + b'\x18\xc61\x8c\x7f') assert(s.origin() == string) = HTTP/2 HPackZString Decompression ~ http2 hpack huffman -s = "\xdeT'" +s = b"\xdeT'" i, ibl = h2.HPackZString.huffman_conv2bitstring(s) assert('Test' == h2.HPackZString.huffman_decode(i, ibl)) -s = ('\x18\xc61\x8cc' * 8191) + '\x18\xc61\x8c\x7f' +s = (b'\x18\xc61\x8cc' * 8191) + b'\x18\xc61\x8c\x7f' i, ibl = h2.HPackZString.huffman_conv2bitstring(s) assert('a'*65535 == h2.HPackZString.huffman_decode(i, ibl)) assert( expect_exception(h2.InvalidEncodingException, - 'h2.HPackZString.huffman_decode(*h2.HPackZString.huffman_conv2bitstring("\xdeT"))') + b'h2.HPackZString.huffman_decode(*h2.HPackZString.huffman_conv2bitstring(b"\xdeT"))') ) + HTTP/2 HPackStrLenField Test Suite @@ -257,7 +257,7 @@ s = f.m2i(TrivialPacket(type=0, len=4), 'Test') assert(isinstance(s, h2.HPackLiteralString)) assert(s.origin() == 'Test') -s = f.m2i(TrivialPacket(type=1, len=3), "\xdeT'") +s = f.m2i(TrivialPacket(type=1, len=3), b"\xdeT'") assert(isinstance(s, h2.HPackZString)) assert(s.origin() == 'Test') @@ -277,7 +277,7 @@ s = f.any2i(TrivialPacket(type=0, len=4), 'Test') assert(isinstance(s, h2.HPackLiteralString)) assert(s.origin() == 'Test') -s = f.any2i(TrivialPacket(type=1, len=3), "\xdeT'") +s = f.any2i(TrivialPacket(type=1, len=3), b"\xdeT'") assert(isinstance(s, h2.HPackZString)) assert(s.origin() == 'Test') @@ -313,7 +313,7 @@ assert(s == s2) s = 'Test' s2 = f.i2m(None, h2.HPackZString(s)) -assert(s2 == "\xdeT'") +assert(s2 == b"\xdeT'") = HTTP/2 HPackStrLenField.addfield ~ http2 hpack field hpackstrlenfield @@ -326,7 +326,7 @@ assert('toto' + s == s2) s = 'Test' s2 = f.addfield(None, 'toto', h2.HPackZString(s)) -assert(s2 == "toto\xdeT'") +assert(s2 == b"toto\xdeT'") = HTTP/2 HPackStrLenField.getfield ~ http2 hpack field hpackstrlenfield @@ -346,7 +346,7 @@ assert(r[0] == 'Toto') assert(isinstance(r[1], h2.HPackLiteralString)) assert(r[1].origin() == 'Test') -r = f.getfield(TrivialPacket(type=1, len=3), "\xdeT'Toto") +r = f.getfield(TrivialPacket(type=1, len=3), b"\xdeT'Toto") assert(isinstance(r, tuple)) assert(r[0] == 'Toto') assert(isinstance(r[1], h2.HPackZString)) @@ -400,23 +400,23 @@ assert(expect_exception(AssertionError, 'f.addfield(None, "toto", 2)')) f = h2.HPackMagicBitField('value', 3, 2) -r = f.getfield(None, '\xc0') +r = f.getfield(None, b'\xc0') assert(isinstance(r, tuple)) assert(len(r) == 2) assert(isinstance(r[0], tuple)) assert(len(r[0]) == 2) -assert(r[0][0] == '\xc0') +assert(r[0][0] == b'\xc0') assert(r[0][1] == 2) assert(r[1] == 3) -r = f.getfield(None, ('\x03', 6)) +r = f.getfield(None, (b'\x03', 6)) assert(isinstance(r, tuple)) assert(len(r) == 2) assert(isinstance(r[0], str)) assert(r[0] == '') assert(r[1] == 3) -expect_exception(AssertionError, 'f.getfield(None, "\x80")') +expect_exception(AssertionError, b'f.getfield(None, b"\x80")') = HTTP/2 HPackMagicBitField.h2i ~ http2 hpack field hpackmagicbitfield @@ -451,13 +451,13 @@ expect_exception(AssertionError, 'f.any2i(None, 2)') = HTTP/2 Dissect HPackHdrString ~ http2 pack dissect hpackhdrstring -p = h2.HPackHdrString('\x04Test') +p = h2.HPackHdrString(b'\x04Test') assert(p.type == 0) assert(p.len == 4) assert(isinstance(p.getfieldval('data'), h2.HPackLiteralString)) assert(p.getfieldval('data').origin() == 'Test') -p = h2.HPackHdrString("\x83\xdeT'") +p = h2.HPackHdrString(b"\x83\xdeT'") assert(p.type == 1) assert(p.len == 3) assert(isinstance(p.getfieldval('data'), h2.HPackZString)) @@ -467,25 +467,25 @@ assert(p.getfieldval('data').origin() == 'Test') ~ http2 hpack build hpackhdrstring p = h2.HPackHdrString(data=h2.HPackLiteralString('Test')) -assert(str(p) == '\x04Test') +assert(str(p) == b'\x04Test') p = h2.HPackHdrString(data=h2.HPackZString('Test')) -assert(str(p) == "\x83\xdeT'") +assert(str(p) == b"\x83\xdeT'") #Fuzzing-able tests p = h2.HPackHdrString(type=1, len=3, data=h2.HPackLiteralString('Test')) -assert(str(p) == '\x83Test') +assert(str(p) == b'\x83Test') + HTTP/2 HPackIndexedHdr Test Suite = HTTP/2 Dissect HPackIndexedHdr ~ http2 hpack dissect hpackindexedhdr -p = h2.HPackIndexedHdr('\x80') +p = h2.HPackIndexedHdr(b'\x80') assert(p.magic == 1) assert(p.index == 0) -p = h2.HPackIndexedHdr('\xFF\x00') +p = h2.HPackIndexedHdr(b'\xFF\x00') assert(p.magic == 1) assert(p.index == 127) @@ -493,17 +493,17 @@ assert(p.index == 127) ~ http2 hpack build hpackindexedhdr p = h2.HPackIndexedHdr(index=0) -assert(str(p) == '\x80') +assert(str(p) == b'\x80') p = h2.HPackIndexedHdr(index=127) -assert(str(p) == '\xFF\x00') +assert(str(p) == b'\xFF\x00') + HTTP/2 HPackLitHdrFldWithIncrIndexing Test Suite = HTTP/2 Dissect HPackLitHdrFldWithIncrIndexing without indexed name ~ http2 hpack dissect hpacklithdrfldwithincrindexing -p = h2.HPackLitHdrFldWithIncrIndexing('\x40\x04Test\x04Toto') +p = h2.HPackLitHdrFldWithIncrIndexing(b'\x40\x04Test\x04Toto') assert(p.magic == 1) assert(p.index == 0) assert(isinstance(p.hdr_name, h2.HPackHdrString)) @@ -518,7 +518,7 @@ assert(p.hdr_value.getfieldval('data').origin() == 'Toto') = HTTP/2 Dissect HPackLitHdrFldWithIncrIndexing with indexed name ~ http2 hpack dissect hpacklithdrfldwithincrindexing -p = h2.HPackLitHdrFldWithIncrIndexing('\x41\x04Toto') +p = h2.HPackLitHdrFldWithIncrIndexing(b'\x41\x04Toto') assert(p.magic == 1) assert(p.index == 1) assert(p.hdr_name is None) @@ -535,7 +535,7 @@ p = h2.HPackLitHdrFldWithIncrIndexing( hdr_name=h2.HPackHdrString(data=h2.HPackLiteralString('Test')), hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Toto')) ) -assert(str(p) == '\x40\x04Test\x04Toto') +assert(str(p) == b'\x40\x04Test\x04Toto') = HTTP/2 Build HPackLitHdrFldWithIncrIndexing with indexed name ~ http2 hpack build hpacklithdrfldwithincrindexing @@ -544,14 +544,14 @@ p = h2.HPackLitHdrFldWithIncrIndexing( index=1, hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Toto')) ) -assert(str(p) == '\x41\x04Toto') +assert(str(p) == b'\x41\x04Toto') + HTTP/2 HPackLitHdrFldWithoutIndexing Test Suite = HTTP/2 Dissect HPackLitHdrFldWithoutIndexing : don't index and no index ~ http2 hpack dissect hpacklithdrfldwithoutindexing -p = h2.HPackLitHdrFldWithoutIndexing('\x00\x04Test\x04Toto') +p = h2.HPackLitHdrFldWithoutIndexing(b'\x00\x04Test\x04Toto') assert(p.magic == 0) assert(p.never_index == 0) assert(p.index == 0) @@ -569,7 +569,7 @@ assert(p.hdr_value.getfieldval('data').origin() == 'Toto') = HTTP/2 Dissect HPackLitHdrFldWithoutIndexing : never index index and no index ~ http2 hpack dissect hpacklithdrfldwithoutindexing -p = h2.HPackLitHdrFldWithoutIndexing('\x10\x04Test\x04Toto') +p = h2.HPackLitHdrFldWithoutIndexing(b'\x10\x04Test\x04Toto') assert(p.magic == 0) assert(p.never_index == 1) assert(p.index == 0) @@ -587,7 +587,7 @@ assert(p.hdr_value.getfieldval('data').origin() == 'Toto') = HTTP/2 Dissect HPackLitHdrFldWithoutIndexing : never index and indexed name ~ http2 hpack dissect hpacklithdrfldwithoutindexing -p = h2.HPackLitHdrFldWithoutIndexing('\x11\x04Toto') +p = h2.HPackLitHdrFldWithoutIndexing(b'\x11\x04Toto') assert(p.magic == 0) assert(p.never_index == 1) assert(p.index == 1) @@ -605,7 +605,7 @@ p = h2.HPackLitHdrFldWithoutIndexing( hdr_name=h2.HPackHdrString(data=h2.HPackLiteralString('Test')), hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Toto')) ) -assert(str(p) == '\x00\x04Test\x04Toto') +assert(str(p) == b'\x00\x04Test\x04Toto') = HTTP/2 Build HPackLitHdrFldWithoutIndexing : never index index and no index ~ http2 hpack build hpacklithdrfldwithoutindexing @@ -615,7 +615,7 @@ p = h2.HPackLitHdrFldWithoutIndexing( hdr_name=h2.HPackHdrString(data=h2.HPackLiteralString('Test')), hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Toto')) ) -assert(str(p) == '\x10\x04Test\x04Toto') +assert(str(p) == b'\x10\x04Test\x04Toto') = HTTP/2 Build HPackLitHdrFldWithoutIndexing : never index and indexed name ~ http2 hpack build hpacklithdrfldwithoutindexing @@ -625,17 +625,17 @@ p = h2.HPackLitHdrFldWithoutIndexing( index=1, hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Toto')) ) -assert(str(p) == '\x11\x04Toto') +assert(str(p) == b'\x11\x04Toto') + HTTP/2 HPackDynamicSizeUpdate Test Suite = HTTP/2 Dissect HPackDynamicSizeUpdate ~ http2 hpack dissect hpackdynamicsizeupdate -p = h2.HPackDynamicSizeUpdate('\x25') +p = h2.HPackDynamicSizeUpdate(b'\x25') assert(p.magic == 1) assert(p.max_size == 5) -p = h2.HPackDynamicSizeUpdate('\x3F\x00') +p = h2.HPackDynamicSizeUpdate(b'\x3F\x00') assert(p.magic == 1) assert(p.max_size == 31) @@ -643,16 +643,16 @@ assert(p.max_size == 31) ~ http2 hpack build hpackdynamicsizeupdate p = h2.HPackDynamicSizeUpdate(max_size=5) -assert(str(p) == '\x25') +assert(str(p) == b'\x25') p = h2.HPackDynamicSizeUpdate(max_size=31) -assert(str(p) == '\x3F\x00') +assert(str(p) == b'\x3F\x00') + HTTP/2 Data Frame Test Suite = HTTP/2 Dissect Data Frame: Simple data frame ~ http2 frame dissect data -pkt = h2.H2Frame('\x00\x00\x04\x00\x00\x00\x00\x00\x01ABCD') +pkt = h2.H2Frame(b'\x00\x00\x04\x00\x00\x00\x00\x00\x01ABCD') assert(pkt.type == 0) assert(pkt.len == 4) assert(len(pkt.flags) == 0) @@ -667,7 +667,7 @@ assert(isinstance(pkt.payload.payload, scapy.packet.NoPayload)) ~ http2 frame build data pkt = h2.H2Frame(stream_id = 1)/h2.H2DataFrame(data='ABCD') -assert(str(pkt) == '\x00\x00\x04\x00\x00\x00\x00\x00\x01ABCD') +assert(str(pkt) == b'\x00\x00\x04\x00\x00\x00\x00\x00\x01ABCD') try: pkt.show2(dump=True) assert(True) @@ -677,7 +677,7 @@ except: = HTTP/2 Dissect Data Frame: Simple data frame with padding ~ http2 frame dissect data -pkt = h2.H2Frame('\x00\x00\r\x00\x08\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') #Padded data frame +pkt = h2.H2Frame(b'\x00\x00\r\x00\x08\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') #Padded data frame assert(pkt.type == 0) assert(pkt.len == 13) assert(len(pkt.flags) == 1) @@ -688,15 +688,15 @@ assert(isinstance(pkt.payload, h2.H2PaddedDataFrame)) assert(pkt[h2.H2PaddedDataFrame]) assert(pkt.payload.padlen == 8) assert(pkt.payload.data == 'ABCD') -assert(pkt.payload.padding == '\x00'*8) +assert(pkt.payload.padding == b'\x00'*8) assert(flags_bit_pattern.search(pkt.show(dump=True)) is None) assert(isinstance(pkt.payload.payload, scapy.packet.NoPayload)) = HTTP/2 Build Data Frame: Simple data frame with padding ~ http2 frame build data -pkt = h2.H2Frame(flags = {'P'}, stream_id = 1)/h2.H2PaddedDataFrame(data='ABCD', padding='\x00'*8) -assert(str(pkt) == '\x00\x00\r\x00\x08\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') +pkt = h2.H2Frame(flags = {'P'}, stream_id = 1)/h2.H2PaddedDataFrame(data='ABCD', padding=b'\x00'*8) +assert(str(pkt) == b'\x00\x00\r\x00\x08\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') try: pkt.show2(dump=True) assert(True) @@ -706,7 +706,7 @@ except: = HTTP/2 Dissect Data Frame: Simple data frame with padding and end stream flag ~ http2 frame dissect data -pkt = h2.H2Frame('\x00\x00\r\x00\t\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') #Padded data frame with end stream flag +pkt = h2.H2Frame(b'\x00\x00\r\x00\t\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') #Padded data frame with end stream flag assert(pkt.type == 0) assert(pkt.len == 13) assert(len(pkt.flags) == 2) @@ -718,15 +718,15 @@ assert(isinstance(pkt.payload, h2.H2PaddedDataFrame)) assert(pkt[h2.H2PaddedDataFrame]) assert(pkt.payload.padlen == 8) assert(pkt.payload.data == 'ABCD') -assert(pkt.payload.padding == '\x00'*8) +assert(pkt.payload.padding == b'\x00'*8) assert(flags_bit_pattern.search(pkt.show(dump=True)) is None) assert(isinstance(pkt.payload.payload, scapy.packet.NoPayload)) = HTTP/2 Build Data Frame: Simple data frame with padding and end stream flag ~ http2 frame build data -pkt = h2.H2Frame(flags = {'P', 'ES'}, stream_id=1)/h2.H2PaddedDataFrame(data='ABCD', padding='\x00'*8) -assert(str(pkt) == '\x00\x00\r\x00\t\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') +pkt = h2.H2Frame(flags = {'P', 'ES'}, stream_id=1)/h2.H2PaddedDataFrame(data='ABCD', padding=b'\x00'*8) +assert(str(pkt) == b'\x00\x00\r\x00\t\x00\x00\x00\x01\x08ABCD\x00\x00\x00\x00\x00\x00\x00\x00') try: pkt.show2(dump=True) assert(True) @@ -738,7 +738,7 @@ except: = HTTP/2 Dissect Headers Frame: Simple header frame ~ http2 frame dissect headers -pkt = h2.H2Frame('\x00\x00\x0e\x01\x00\x00\x00\x00\x01\x88\x0f\x10\ntext/plain') #Header frame +pkt = h2.H2Frame(b'\x00\x00\x0e\x01\x00\x00\x00\x00\x01\x88\x0f\x10\ntext/plain') #Header frame assert(pkt.type == 1) assert(pkt.len == 14) assert(len(pkt.flags) == 0) @@ -775,12 +775,12 @@ p = h2.H2Frame(stream_id=1)/h2.H2HeadersFrame(hdrs=[ ) ] ) -assert(str(p) == '\x00\x00\x0e\x01\x00\x00\x00\x00\x01\x88\x0f\x10\ntext/plain') +assert(str(p) == b'\x00\x00\x0e\x01\x00\x00\x00\x00\x01\x88\x0f\x10\ntext/plain') = HTTP/2 Dissect Headers Frame: Header frame with padding ~ http2 frame dissect headers -pkt = h2.H2Frame('\x00\x00\x17\x01\x08\x00\x00\x00\x01\x08\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') #Header frame with padding +pkt = h2.H2Frame(b'\x00\x00\x17\x01\x08\x00\x00\x00\x01\x08\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') #Header frame with padding assert(pkt.type == 1) assert(pkt.len == 23) assert(len(pkt.flags) == 1) @@ -792,7 +792,7 @@ assert(flags_bit_pattern.search(pkt.show(dump=True)) is None) assert(pkt[h2.H2PaddedHeadersFrame]) hf = pkt[h2.H2PaddedHeadersFrame] assert(hf.padlen == 8) -assert(hf.padding == '\x00' * 8) +assert(hf.padding == b'\x00' * 8) assert(len(hf.hdrs) == 2) assert(isinstance(hf.hdrs[0], h2.HPackIndexedHdr)) assert(hf.hdrs[0].magic == 1) @@ -821,14 +821,14 @@ p = h2.H2Frame(flags={'P'}, stream_id=1)/h2.H2PaddedHeadersFrame( hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('text/plain')) ) ], - padding='\x00'*8, + padding=b'\x00'*8, ) -assert(str(p) == '\x00\x00\x17\x01\x08\x00\x00\x00\x01\x08\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') +assert(str(p) == b'\x00\x00\x17\x01\x08\x00\x00\x00\x01\x08\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') = HTTP/2 Dissect Headers Frame: Header frame with priority ~ http2 frame dissect headers -pkt = h2.H2Frame('\x00\x00\x13\x01 \x00\x00\x00\x01\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain') #Header frame with priority +pkt = h2.H2Frame(b'\x00\x00\x13\x01 \x00\x00\x00\x01\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain') #Header frame with priority assert(pkt.type == 1) assert(pkt.len == 19) assert(len(pkt.flags) == 1) @@ -874,12 +874,12 @@ p = h2.H2Frame(flags={'+'}, stream_id=1)/h2.H2PriorityHeadersFrame( ) ] ) -assert(str(p) == '\x00\x00\x13\x01 \x00\x00\x00\x01\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain') +assert(str(p) == b'\x00\x00\x13\x01 \x00\x00\x00\x01\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain') = HTTP/2 Dissect Headers Frame: Header frame with priority and padding and flags ~ http2 frame dissect headers -pkt = h2.H2Frame('\x00\x00\x1c\x01-\x00\x00\x00\x01\x08\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') #Header frame with priority and padding and flags ES|EH +pkt = h2.H2Frame(b'\x00\x00\x1c\x01-\x00\x00\x00\x01\x08\x00\x00\x00\x02d\x88\x0f\x10\ntext/plain\x00\x00\x00\x00\x00\x00\x00\x00') #Header frame with priority and padding and flags ES|EH assert(pkt.type == 1) assert(pkt.len == 28) assert(len(pkt.flags) == 4) @@ -894,7 +894,7 @@ assert(flags_bit_pattern.search(pkt.show(dump=True)) is None) assert(pkt[h2.H2PaddedPriorityHeadersFrame]) hf = pkt[h2.H2PaddedPriorityHeadersFrame] assert(hf.padlen == 8) -assert(hf.padding == '\x00' * 8) +assert(hf.padding == b'\x00' * 8) assert(hf.exclusive == 0) assert(hf.stream_dependency == 2) assert(hf.weight == 100) @@ -922,7 +922,7 @@ p = h2.H2Frame(flags={'P', '+', 'ES', 'EH'}, stream_id=1)/h2.H2PaddedPriorityHea exclusive=0, stream_dependency=2, weight=100, - padding='\x00'*8, + padding=b'\x00'*8, hdrs=[ h2.HPackIndexedHdr(index=8), h2.HPackLitHdrFldWithoutIndexing( @@ -937,7 +937,7 @@ p = h2.H2Frame(flags={'P', '+', 'ES', 'EH'}, stream_id=1)/h2.H2PaddedPriorityHea = HTTP/2 Dissect Priority Frame ~ http2 frame dissect priority -pkt = h2.H2Frame('\x00\x00\x05\x02\x00\x00\x00\x00\x03\x80\x00\x00\x01d') +pkt = h2.H2Frame(b'\x00\x00\x05\x02\x00\x00\x00\x00\x03\x80\x00\x00\x01d') assert(pkt.type == 2) assert(pkt.len == 5) assert(len(pkt.flags) == 0) @@ -958,14 +958,14 @@ p = h2.H2Frame(stream_id=3)/h2.H2PriorityFrame( stream_dependency=1, weight=100 ) -assert(str(p) == '\x00\x00\x05\x02\x00\x00\x00\x00\x03\x80\x00\x00\x01d') +assert(str(p) == b'\x00\x00\x05\x02\x00\x00\x00\x00\x03\x80\x00\x00\x01d') + HTTP/2 Reset Stream Frame Test Suite = HTTP/2 Dissect Reset Stream Frame: Protocol Error ~ http2 frame dissect rststream -pkt = h2.H2Frame('\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') #Reset stream with protocol error +pkt = h2.H2Frame(b'\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') #Reset stream with protocol error assert(pkt.type == 3) assert(pkt.len == 4) assert(len(pkt.flags) == 0) @@ -981,15 +981,15 @@ assert(isinstance(rf.payload, scapy.packet.NoPayload)) ~ http2 frame build rststream p = h2.H2Frame(stream_id=1)/h2.H2ResetFrame(error='Protocol error') -assert(str(p) == '\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') +assert(str(p) == b'\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') p = h2.H2Frame(stream_id=1)/h2.H2ResetFrame(error=1) -assert(str(p) == '\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') +assert(str(p) == b'\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01') = HTTP/2 Dissect Reset Stream Frame: Raw 123456 error ~ http2 frame dissect rststream -pkt = h2.H2Frame('\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x01\xe2@') #Reset stream with raw error +pkt = h2.H2Frame(b'\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x01\xe2@') #Reset stream with raw error assert(pkt.type == 3) assert(pkt.len == 4) assert(len(pkt.flags) == 0) @@ -1005,14 +1005,14 @@ assert(isinstance(rf.payload, scapy.packet.NoPayload)) ~ http2 frame dissect rststream p = h2.H2Frame(stream_id=1)/h2.H2ResetFrame(error=123456) -assert(str(p) == '\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x01\xe2@') +assert(str(p) == b'\x00\x00\x04\x03\x00\x00\x00\x00\x01\x00\x01\xe2@') + HTTP/2 Settings Frame Test Suite = HTTP/2 Dissect Settings Frame: Settings Frame ~ http2 frame dissect settings -pkt = h2.H2Frame('\x00\x00$\x04\x00\x00\x00\x00\x00\x00\x01\x07[\xcd\x15\x00\x02\x00\x00\x00\x01\x00\x03\x00\x00\x00{\x00\x04\x00\x12\xd6\x87\x00\x05\x00\x01\xe2@\x00\x06\x00\x00\x00{') #Settings frame +pkt = h2.H2Frame(b'\x00\x00$\x04\x00\x00\x00\x00\x00\x00\x01\x07[\xcd\x15\x00\x02\x00\x00\x00\x01\x00\x03\x00\x00\x00{\x00\x04\x00\x12\xd6\x87\x00\x05\x00\x01\xe2@\x00\x06\x00\x00\x00{') #Settings frame assert(pkt.type == 4) assert(pkt.len == 36) assert(len(pkt.flags) == 0) @@ -1054,7 +1054,7 @@ p = h2.H2Frame()/h2.H2SettingsFrame(settings=[ h2.H2Setting(id='Max header list size', value=123) ] ) -assert(str(p) == '\x00\x00$\x04\x00\x00\x00\x00\x00\x00\x01\x07[\xcd\x15\x00\x02\x00\x00\x00\x01\x00\x03\x00\x00\x00{\x00\x04\x00\x12\xd6\x87\x00\x05\x00\x01\xe2@\x00\x06\x00\x00\x00{') +assert(str(p) == b'\x00\x00$\x04\x00\x00\x00\x00\x00\x00\x01\x07[\xcd\x15\x00\x02\x00\x00\x00\x01\x00\x03\x00\x00\x00{\x00\x04\x00\x12\xd6\x87\x00\x05\x00\x01\xe2@\x00\x06\x00\x00\x00{') = HTTP/2 Dissect Settings Frame: Incomplete Settings Frame ~ http2 frame dissect settings @@ -1065,7 +1065,7 @@ assert(expect_exception(AssertionError, 'h2.H2Frame("0000240400000000000001075bc = HTTP/2 Dissect Settings Frame: Settings Frame acknowledgement ~ http2 frame dissect settings -pkt = h2.H2Frame('\x00\x00\x00\x04\x01\x00\x00\x00\x00') #Settings frame w/ ack flag +pkt = h2.H2Frame(b'\x00\x00\x00\x04\x01\x00\x00\x00\x00') #Settings frame w/ ack flag assert(pkt.type == 4) assert(pkt.len == 0) assert(len(pkt.flags) == 1) @@ -1079,14 +1079,14 @@ assert(isinstance(pkt.payload, scapy.packet.NoPayload)) ~ http2 frame build settings p = h2.H2Frame(type=h2.H2SettingsFrame.type_id, flags={'A'}) -assert(str(p) == '\x00\x00\x00\x04\x01\x00\x00\x00\x00') +assert(str(p) == b'\x00\x00\x00\x04\x01\x00\x00\x00\x00') + HTTP/2 Push Promise Frame Test Suite = HTTP/2 Dissect Push Promise Frame: no flag & headers with compression and hdr_name ~ http2 frame dissect pushpromise -pkt = h2.H2Frame('\x00\x00\x15\x05\x00\x00\x00\x00\x01\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +pkt = h2.H2Frame(b'\x00\x00\x15\x05\x00\x00\x00\x00\x01\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') assert(pkt.type == 5) assert(pkt.len == 21) assert(len(pkt.flags) == 0) @@ -1121,12 +1121,12 @@ p = h2.H2Frame(stream_id=1)/h2.H2PushPromiseFrame(stream_id=3,hdrs=[ hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Me')), ) ]) -assert(str(p) == '\x00\x00\x15\x05\x00\x00\x00\x00\x01\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +assert(str(p) == b'\x00\x00\x15\x05\x00\x00\x00\x00\x01\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') = HTTP/2 Dissect Push Promise Frame: with padding, the flag END_Header & headers with compression and hdr_name ~ http2 frame dissect pushpromise -pkt = h2.H2Frame('\x00\x00\x1e\x05\x0c\x00\x00\x00\x01\x08\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me\x00\x00\x00\x00\x00\x00\x00\x00') +pkt = h2.H2Frame(b'\x00\x00\x1e\x05\x0c\x00\x00\x00\x01\x08\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me\x00\x00\x00\x00\x00\x00\x00\x00') assert(pkt.type == 5) assert(pkt.len == 30) assert(len(pkt.flags) == 2) @@ -1139,7 +1139,7 @@ assert(isinstance(pkt.payload, h2.H2PaddedPushPromiseFrame)) assert(pkt[h2.H2PaddedPushPromiseFrame]) pf = pkt[h2.H2PaddedPushPromiseFrame] assert(pf.padlen == 8) -assert(pf.padding == '\x00'*8) +assert(pf.padding == b'\x00'*8) assert(pf.stream_id == 3) assert(len(pf.hdrs) == 1) hdr = pf.hdrs[0] @@ -1166,16 +1166,16 @@ p = h2.H2Frame(flags={'P', 'EH'}, stream_id=1)/h2.H2PaddedPushPromiseFrame( hdr_value=h2.HPackHdrString(data=h2.HPackLiteralString('Me')) ) ], - padding='\x00'*8 + padding=b'\x00'*8 ) -assert(str(p) == '\x00\x00\x1e\x05\x0c\x00\x00\x00\x01\x08\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me\x00\x00\x00\x00\x00\x00\x00\x00') +assert(str(p) == b'\x00\x00\x1e\x05\x0c\x00\x00\x00\x01\x08\x00\x00\x00\x03@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me\x00\x00\x00\x00\x00\x00\x00\x00') + HTTP/2 Ping Frame Test Suite = HTTP/2 Dissect Ping Frame: Ping frame ~ http2 frame dissect ping -pkt = h2.H2Frame('\x00\x00\x08\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') #Ping frame with payload +pkt = h2.H2Frame(b'\x00\x00\x08\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') #Ping frame with payload assert(pkt.type == 6) assert(pkt.len == 8) assert(len(pkt.flags) == 0) @@ -1191,12 +1191,12 @@ assert(isinstance(pf.payload, scapy.packet.NoPayload)) ~ http2 frame build ping p = h2.H2Frame()/h2.H2PingFrame(opaque=123456) -assert(str(p) == '\x00\x00\x08\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') +assert(str(p) == b'\x00\x00\x08\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') = HTTP/2 Dissect Ping Frame: Pong frame ~ http2 frame dissect ping -pkt = h2.H2Frame('\x00\x00\x08\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') #Pong frame +pkt = h2.H2Frame(b'\x00\x00\x08\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') #Pong frame assert(pkt.type == 6) assert(pkt.len == 8) assert(len(pkt.flags) == 1) @@ -1214,14 +1214,14 @@ assert(isinstance(pf.payload, scapy.packet.NoPayload)) ~ http2 frame dissect ping p = h2.H2Frame(flags={'A'})/h2.H2PingFrame(opaque=123456) -assert(str(p) == '\x00\x00\x08\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') +assert(str(p) == b'\x00\x00\x08\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe2@') + HTTP/2 Go Away Frame Test Suite = HTTP/2 Dissect Go Away Frame: No error ~ http2 frame dissect goaway -pkt = h2.H2Frame('\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00') #Go Away for no particular reason :) +pkt = h2.H2Frame(b'\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00') #Go Away for no particular reason :) assert(pkt.type == 7) assert(pkt.len == 8) assert(len(pkt.flags) == 0) @@ -1240,12 +1240,12 @@ assert(isinstance(gf.payload, scapy.packet.NoPayload)) ~ http2 frame build goaway p = h2.H2Frame()/h2.H2GoAwayFrame(last_stream_id=1, error='No error') -assert(str(p) == '\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00') +assert(str(p) == b'\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00') = HTTP/2 Dissect Go Away Frame: Arbitrary error with additional data ~ http2 frame dissect goaway -pkt = h2.H2Frame('\x00\x00\x10\x07\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\xe2@\x00\x00\x00\x00\x00\x00\x00\x00') #Go Away with debug data +pkt = h2.H2Frame(b'\x00\x00\x10\x07\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\xe2@\x00\x00\x00\x00\x00\x00\x00\x00') #Go Away with debug data assert(pkt.type == 7) assert(pkt.len == 16) assert(len(pkt.flags) == 0) @@ -1266,16 +1266,16 @@ assert(isinstance(gf.payload, scapy.packet.NoPayload)) p = h2.H2Frame()/h2.H2GoAwayFrame( last_stream_id=2, error=123456, - additional_data='\x00'*8 + additional_data=b'\x00'*8 ) -assert(str(p) == '\x00\x00\x10\x07\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\xe2@\x00\x00\x00\x00\x00\x00\x00\x00') +assert(str(p) == b'\x00\x00\x10\x07\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\xe2@\x00\x00\x00\x00\x00\x00\x00\x00') + HTTP/2 Window Update Frame Test Suite = HTTP/2 Dissect Window Update Frame: global ~ http2 frame dissect winupdate -pkt = h2.H2Frame('\x00\x00\x04\x08\x00\x00\x00\x00\x00\x00\x01\xe2@') #Window update with increment for connection +pkt = h2.H2Frame(b'\x00\x00\x04\x08\x00\x00\x00\x00\x00\x00\x01\xe2@') #Window update with increment for connection assert(pkt.type == 8) assert(pkt.len == 4) assert(len(pkt.flags) == 0) @@ -1292,12 +1292,12 @@ assert(isinstance(wf.payload, scapy.packet.NoPayload)) ~ http2 frame build winupdate p = h2.H2Frame()/h2.H2WindowUpdateFrame(win_size_incr=123456) -assert(str(p) == '\x00\x00\x04\x08\x00\x00\x00\x00\x00\x00\x01\xe2@') +assert(str(p) == b'\x00\x00\x04\x08\x00\x00\x00\x00\x00\x00\x01\xe2@') = HTTP/2 Dissect Window Update Frame: a stream ~ http2 frame dissect winupdate -pkt = h2.H2Frame('\x00\x00\x04\x08\x00\x00\x00\x00\x01\x00\x01\xe2@') #Window update with increment for a stream +pkt = h2.H2Frame(b'\x00\x00\x04\x08\x00\x00\x00\x00\x01\x00\x01\xe2@') #Window update with increment for a stream assert(pkt.type == 8) assert(pkt.len == 4) assert(len(pkt.flags) == 0) @@ -1314,14 +1314,14 @@ assert(isinstance(wf.payload, scapy.packet.NoPayload)) ~ http2 frame build winupdate p = h2.H2Frame(stream_id=1)/h2.H2WindowUpdateFrame(win_size_incr=123456) -assert(str(p) == '\x00\x00\x04\x08\x00\x00\x00\x00\x01\x00\x01\xe2@') +assert(str(p) == b'\x00\x00\x04\x08\x00\x00\x00\x00\x01\x00\x01\xe2@') + HTTP/2 Continuation Frame Test Suite = HTTP/2 Dissect Continuation Frame: no flag & headers with compression and hdr_name ~ http2 frame dissect continuation -pkt = h2.H2Frame('\x00\x00\x11\t\x00\x00\x00\x00\x01@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +pkt = h2.H2Frame(b'\x00\x00\x11\t\x00\x00\x00\x00\x01@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') assert(pkt.type == 9) assert(pkt.len == 17) assert(len(pkt.flags) == 0) @@ -1356,12 +1356,12 @@ p = h2.H2Frame(stream_id=1)/h2.H2ContinuationFrame( ) ] ) -assert(str(p) == '\x00\x00\x11\t\x00\x00\x00\x00\x01@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +assert(str(p) == b'\x00\x00\x11\t\x00\x00\x00\x00\x01@\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') = HTTP/2 Dissect Continuation Frame: flag END_Header & headers with compression, sensitive flag and hdr_name ~ http2 frame dissect continuation -pkt = h2.H2Frame('\x00\x00\x11\t\x04\x00\x00\x00\x01\x10\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +pkt = h2.H2Frame(b'\x00\x00\x11\t\x04\x00\x00\x00\x01\x10\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') assert(pkt.type == 9) assert(pkt.len == 17) assert(len(pkt.flags) == 1) @@ -1400,7 +1400,7 @@ p = h2.H2Frame(flags={'EH'}, stream_id=1)/h2.H2ContinuationFrame( ) ] ) -assert(str(p) == '\x00\x00\x11\t\x04\x00\x00\x00\x01\x10\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') +assert(str(p) == b'\x00\x00\x11\t\x04\x00\x00\x00\x01\x10\x8c\xfc[i{ZT$\xb2-\xc8\xc9\x9f\x02Me') + HTTP/2 HPackHdrTable Test Suite diff --git a/scapy/contrib/isis.py b/scapy/contrib/isis.py index 814439a4f1c193d97b2be5ca4d109206edd666e2..3b7122e30b36b0d29ab213162fd941d78c728716 100644 --- a/scapy/contrib/isis.py +++ b/scapy/contrib/isis.py @@ -114,7 +114,7 @@ class _ISIS_IdFieldBase(Field): def i2m(self, pkt, x): if x is None: - return "\0"*self.length + return b"\0"*self.length return self.to_str(x) @@ -306,13 +306,13 @@ class ISIS_IPv6NeighborAddressSubTlv(ISIS_GenericSubTlv): ## ISIS Sub-TLVs for TLVs 135, 235, 236, and 237 ## ####################################################################### _isis_subtlv_classes_2 = { - 1: "ISIS_32bitAdministrativeTagSubTlv", - 2: "ISIS_64bitAdministrativeTagSubTlv" + 1: "ISIS_32bitAdministrativeTagSubTlv", + 2: "ISIS_64bitAdministrativeTagSubTlv" } _isis_subtlv_names_2 = { - 1: "32-bit Administrative Tag", - 2: "64-bit Administrative Tag" + 1: "32-bit Administrative Tag", + 2: "64-bit Administrative Tag" } diff --git a/scapy/contrib/isis.uts b/scapy/contrib/isis.uts index 95c9ba2025372d372d900d4fe2d75abc9dceb496..e004d5cdaa942a1dcaebf08caaa78bb6d12ba323 100644 --- a/scapy/contrib/isis.uts +++ b/scapy/contrib/isis.uts @@ -47,7 +47,7 @@ p = Dot3(dst="09:00:2b:00:00:05",src="00:00:00:aa:00:8c")/LLC()/ISIS_CommonHdr() ), ISIS_GenericTlv( type=134, - val="\xac\x10\x08\x10" + val=b"\xac\x10\x08\x10" ), ISIS_ExtendedIpReachabilityTlv( pfxs=[ @@ -89,7 +89,7 @@ p = Dot3(dst="09:00:2b:00:00:05",src="00:00:00:aa:00:8c")/LLC()/ISIS_CommonHdr() ), ISIS_GenericTlv( type=134, - val="\xac\x10\x08\x10" + val=b"\xac\x10\x08\x10" ), ISIS_ExtendedIpReachabilityTlv( pfxs=[ @@ -101,7 +101,7 @@ p = Dot3(dst="09:00:2b:00:00:05",src="00:00:00:aa:00:8c")/LLC()/ISIS_CommonHdr() ]), ISIS_ExtendedIpPrefix(metric=10, pfx="10.1.0.181/30", subtlvindicator=1, subtlvs=[ - ISIS_GenericSubTlv(type=123, val="\x11\x1f\x01\x1c") + ISIS_GenericSubTlv(type=123, val=b"\x11\x1f\x01\x1c") ]) ] ), @@ -110,7 +110,7 @@ p = Dot3(dst="09:00:2b:00:00:05",src="00:00:00:aa:00:8c")/LLC()/ISIS_CommonHdr() ISIS_Ipv6Prefix(metric=0, pfx="fe10:1::10/128"), ISIS_Ipv6Prefix(metric=10, pfx="fd1f:1::/64", subtlvindicator=1, subtlvs=[ - ISIS_GenericSubTlv(type=99, val="\x1f\x01\x1f\x01\x11\x1f\x01\x1c") + ISIS_GenericSubTlv(type=99, val=b"\x1f\x01\x1f\x01\x11\x1f\x01\x1c") ]), ISIS_Ipv6Prefix(metric=10, pfx="fd1f:1:12::/64") ] diff --git a/scapy/contrib/ldp.py b/scapy/contrib/ldp.py index 9614ad3048308cdf05739359433631f2cdaf583f..b27b39699166e681c418893d583e618a078d7b00 100644 --- a/scapy/contrib/ldp.py +++ b/scapy/contrib/ldp.py @@ -73,7 +73,7 @@ class FecTLVField(StrField): nbroctets = mask / 8 if mask % 8: nbroctets += 1 - add=inet_ntoa(x[4:4+nbroctets]+"\x00"*(4-nbroctets)) + add=inet_ntoa(x[4:4+nbroctets]+b"\x00"*(4-nbroctets)) list.append( (add, mask) ) used += 4 + nbroctets x=x[4+nbroctets:] @@ -81,11 +81,11 @@ class FecTLVField(StrField): def i2m(self, pkt, x): if type(x) is str: return x - s = "\x01\x00" + s = b"\x01\x00" l = 0 fec = "" for o in x: - fec += "\x02\x00\x01" + fec += b"\x02\x00\x01" # mask length fec += struct.pack("!B",o[1]) # Prefix @@ -111,7 +111,7 @@ class LabelTLVField(StrField): def i2m(self, pkt, x): if type(x) is str: return x - s = "\x02\x00\x00\x04" + s = b"\x02\x00\x00\x04" s += struct.pack("!I",x) return s def size(self, s): @@ -140,7 +140,7 @@ class AddressTLVField(StrField): if type(x) is str: return x l=2+len(x)*4 - s = "\x01\x01"+struct.pack("!H",l)+"\x00\x01" + s = b"\x01\x01"+struct.pack("!H",l)+b"\x00\x01" for o in x: s += inet_aton(o) return s @@ -169,7 +169,7 @@ class StatusTLVField(StrField): def i2m(self, pkt, x): if type(x) is str: return x - s = "\x03\x00" + struct.pack("!H",10) + s = b"\x03\x00" + struct.pack("!H",10) statuscode = 0 if x[0] != 0: statuscode += 2**31 @@ -180,11 +180,11 @@ class StatusTLVField(StrField): if len(x) > 3: s += struct.pack("!I",x[3]) else: - s += "\x00\x00\x00\x00" + s += b"\x00\x00\x00\x00" if len(x) > 4: s += struct.pack("!H",x[4]) else: - s += "\x00\x00" + s += b"\x00\x00" return s def getfield(self, pkt, s): l = 14 @@ -207,7 +207,7 @@ class CommonHelloTLVField(StrField): def i2m(self, pkt, x): if type(x) is str: return x - s = "\x04\x00\x00\x04" + s = b"\x04\x00\x00\x04" s += struct.pack("!H",x[0]) byte = 0 if x[1] == 1: @@ -215,7 +215,7 @@ class CommonHelloTLVField(StrField): if x[2] == 1: byte += 0x40 s += struct.pack("!B",byte) - s += "\x00" + s += b"\x00" return s def getfield(self, pkt, s): l = 8 @@ -238,7 +238,7 @@ class CommonSessionTLVField(StrField): def i2m(self, pkt, x): if type(x) is str: return x - s = "\x05\x00\x00\x0E\x00\x01" + s = b"\x05\x00\x00\x0E\x00\x01" s += struct.pack("!H",x[0]) octet = 0 if x[1] != 0: diff --git a/scapy/contrib/modbus.uts b/scapy/contrib/modbus.uts index 303cd285a9fd5dabe2b27c7d973d4bd8f1b17409..210e191b2fb994225bb2a274f23c28542cde7d5f 100644 --- a/scapy/contrib/modbus.uts +++ b/scapy/contrib/modbus.uts @@ -6,39 +6,39 @@ from scapy.contrib.modbus import * + Test MBAP = MBAP default values -str(ModbusADURequest()) == '\x00\x00\x00\x00\x00\x01\xff' +str(ModbusADURequest()) == b'\x00\x00\x00\x00\x00\x01\xff' = MBAP payload length calculation -str(ModbusADURequest() / '\x00\x01\x02') == '\x00\x00\x00\x00\x00\x04\xff\x00\x01\x02' +str(ModbusADURequest() / b'\x00\x01\x02') == b'\x00\x00\x00\x00\x00\x04\xff\x00\x01\x02' = MBAP Guess Payload ModbusPDU01ReadCoilsRequest (simple case) -p = ModbusADURequest('\x00\x00\x00\x00\x00\x06\xff\x01\x00\x00\x00\x01') +p = ModbusADURequest(b'\x00\x00\x00\x00\x00\x06\xff\x01\x00\x00\x00\x01') assert(isinstance(p.payload, ModbusPDU01ReadCoilsRequest)) = MBAP Guess Payload ModbusPDU01ReadCoilsResponse -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x04\xff\x01\x01\x01') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x04\xff\x01\x01\x01') assert(isinstance(p.payload, ModbusPDU01ReadCoilsResponse)) = MBAP Guess Payload ModbusPDU01ReadCoilsError -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x03\xff\x81\x02') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x03\xff\x81\x02') assert(isinstance(p.payload, ModbusPDU01ReadCoilsError)) = MBAP Guess Payload ModbusPDU2B0EReadDeviceIdentificationRequest (2 level test) -p = ModbusADURequest('\x00\x00\x00\x00\x00\x04\xff+\x0e\x01\x00') +p = ModbusADURequest(b'\x00\x00\x00\x00\x00\x04\xff+\x0e\x01\x00') assert(isinstance(p.payload, ModbusPDU2B0EReadDeviceIdentificationRequest)) = MBAP Guess Payload ModbusPDU2B0EReadDeviceIdentificationResponse -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x1b\xff+\x0e\x01\x83\x00\x00\x03\x00\x08Pymodbus\x01\x02PM\x02\x031.0') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x1b\xff+\x0e\x01\x83\x00\x00\x03\x00\x08Pymodbus\x01\x02PM\x02\x031.0') assert(isinstance(p.payload, ModbusPDU2B0EReadDeviceIdentificationResponse)) = MBAP Guess Payload ModbusPDU2B0EReadDeviceIdentificationError -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x03\xff\xab\x01') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x03\xff\xab\x01') assert(isinstance(p.payload, ModbusPDU2B0EReadDeviceIdentificationError)) = MBAP Guess Payload (Invalid payload) -p = ModbusADURequest('\x00\x00\x00\x00\x00\x03\xff\xff\xff') +p = ModbusADURequest(b'\x00\x00\x00\x00\x00\x03\xff\xff\xff') assert(isinstance(p.payload, ModbusPDU00GenericRequest)) = MBAP Guess Payload ModbusPDU02ReadDiscreteInputsResponse -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x04\xff\x80\xff\x00') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x04\xff\x80\xff\x00') assert(isinstance(p.payload, ModbusPDU00GenericResponse)) = MBAP Guess Payload ModbusPDU02ReadDiscreteInputsError -p = ModbusADUResponse('\x00\x00\x00\x00\x00\x04\xff\xff\xff\xff') +p = ModbusADUResponse(b'\x00\x00\x00\x00\x00\x04\xff\xff\xff\xff') assert(isinstance(p.payload, ModbusPDU00GenericError)) @@ -55,99 +55,99 @@ p[TCP].sport == 502 * Note on tests cases: dissection/minimal parameters will not be done for packets that does not perform calculation # 0x01/0x81 Read Coils -------------------------------------------------------------- = ModbusPDU01ReadCoilsRequest -str(ModbusPDU01ReadCoilsRequest()) == '\x01\x00\x00\x00\x01' +str(ModbusPDU01ReadCoilsRequest()) == b'\x01\x00\x00\x00\x01' = ModbusPDU01ReadCoilsRequest minimal parameters -str(ModbusPDU01ReadCoilsRequest(startAddr=16, quantity=2)) == '\x01\x00\x10\x00\x02' +str(ModbusPDU01ReadCoilsRequest(startAddr=16, quantity=2)) == b'\x01\x00\x10\x00\x02' = ModbusPDU01ReadCoilsRequest dissection -p = ModbusPDU01ReadCoilsRequest('\x01\x00\x10\x00\x02') +p = ModbusPDU01ReadCoilsRequest(b'\x01\x00\x10\x00\x02') assert(p.startAddr == 16) assert(p.quantity == 2) = ModbusPDU01ReadCoilsResponse -str(ModbusPDU01ReadCoilsResponse()) == '\x01\x01\x00' +str(ModbusPDU01ReadCoilsResponse()) == b'\x01\x01\x00' = ModbusPDU01ReadCoilsResponse minimal parameters -str(ModbusPDU01ReadCoilsResponse(coilStatus=[0x10]*3)) == '\x01\x03\x10\x10\x10' +str(ModbusPDU01ReadCoilsResponse(coilStatus=[0x10]*3)) == b'\x01\x03\x10\x10\x10' = ModbusPDU01ReadCoilsResponse dissection -p = ModbusPDU01ReadCoilsResponse('\x01\x03\x10\x10\x10') +p = ModbusPDU01ReadCoilsResponse(b'\x01\x03\x10\x10\x10') assert(p.coilStatus == [16, 16, 16]) assert(p.byteCount == 3) = ModbusPDU01ReadCoilsError -str(ModbusPDU01ReadCoilsError() == '\x81\x01') +str(ModbusPDU01ReadCoilsError() == b'\x81\x01') = ModbusPDU81ReadCoilsError minimal parameters -str(ModbusPDU01ReadCoilsError(exceptCode=2)) == '\x81\x02' +str(ModbusPDU01ReadCoilsError(exceptCode=2)) == b'\x81\x02' = ModbusPDU81ReadCoilsError dissection -p = ModbusPDU01ReadCoilsError('\x81\x02') +p = ModbusPDU01ReadCoilsError(b'\x81\x02') assert(p.funcCode == 0x81) assert(p.exceptCode == 2) # 0x02/0x82 Read Discrete Inputs Registers ------------------------------------------ = ModbusPDU02ReadDiscreteInputsRequest -str(ModbusPDU02ReadDiscreteInputsRequest()) == '\x02\x00\x00\x00\x01' +str(ModbusPDU02ReadDiscreteInputsRequest()) == b'\x02\x00\x00\x00\x01' = ModbusPDU02ReadDiscreteInputsRequest minimal parameters -str(ModbusPDU02ReadDiscreteInputsRequest(startAddr=8, quantity=128)) == '\x02\x00\x08\x00\x80' +str(ModbusPDU02ReadDiscreteInputsRequest(startAddr=8, quantity=128)) == b'\x02\x00\x08\x00\x80' = ModbusPDU02ReadDiscreteInputsResponse -str(ModbusPDU02ReadDiscreteInputsResponse()) == '\x02\x01\x00' +str(ModbusPDU02ReadDiscreteInputsResponse()) == b'\x02\x01\x00' = ModbusPDU02ReadDiscreteInputsResponse minimal parameters -str(ModbusPDU02ReadDiscreteInputsResponse(inputStatus=[0x02, 0x01])) == '\x02\x02\x02\x01' +str(ModbusPDU02ReadDiscreteInputsResponse(inputStatus=[0x02, 0x01])) == b'\x02\x02\x02\x01' = ModbusPDU02ReadDiscreteInputsRequest dissection -p = ModbusPDU02ReadDiscreteInputsResponse('\x02\x02\x02\x01') +p = ModbusPDU02ReadDiscreteInputsResponse(b'\x02\x02\x02\x01') assert(p.byteCount == 2) assert(p.inputStatus == [0x02, 0x01]) = ModbusPDU02ReadDiscreteInputsError -str(ModbusPDU02ReadDiscreteInputsError()) == '\x82\x01' +str(ModbusPDU02ReadDiscreteInputsError()) == b'\x82\x01' # 0x03/0x83 Read Holding Registers -------------------------------------------------- = ModbusPDU03ReadHoldingRegistersRequest -str(ModbusPDU03ReadHoldingRegistersRequest()) == '\x03\x00\x00\x00\x01' +str(ModbusPDU03ReadHoldingRegistersRequest()) == b'\x03\x00\x00\x00\x01' = ModbusPDU03ReadHoldingRegistersRequest minimal parameters -str(ModbusPDU03ReadHoldingRegistersRequest(startAddr=2048, quantity=16)) == '\x03\x08\x00\x00\x10' +str(ModbusPDU03ReadHoldingRegistersRequest(startAddr=2048, quantity=16)) == b'\x03\x08\x00\x00\x10' = ModbusPDU03ReadHoldingRegistersResponse -str(ModbusPDU03ReadHoldingRegistersResponse()) == '\x03\x02\x00\x00' +str(ModbusPDU03ReadHoldingRegistersResponse()) == b'\x03\x02\x00\x00' = ModbusPDU03ReadHoldingRegistersResponse minimal parameters 1==1 = ModbusPDU03ReadHoldingRegistersResponse dissection -p = ModbusPDU03ReadHoldingRegistersResponse('\x03\x06\x02+\x00\x00\x00d') +p = ModbusPDU03ReadHoldingRegistersResponse(b'\x03\x06\x02+\x00\x00\x00d') assert(p.byteCount == 6) assert(p.registerVal == [555, 0, 100]) = ModbusPDU03ReadHoldingRegistersError -str(ModbusPDU03ReadHoldingRegistersError()) == '\x83\x01' +str(ModbusPDU03ReadHoldingRegistersError()) == b'\x83\x01' # 0x04/0x84 Read Input Register ----------------------------------------------------- = ModbusPDU04ReadInputRegistersRequest -str(ModbusPDU04ReadInputRegistersRequest()) == '\x04\x00\x00\x00\x01' +str(ModbusPDU04ReadInputRegistersRequest()) == b'\x04\x00\x00\x00\x01' = ModbusPDU04ReadInputRegistersResponse -str(ModbusPDU04ReadInputRegistersResponse()) == '\x04\x02\x00\x00' +str(ModbusPDU04ReadInputRegistersResponse()) == b'\x04\x02\x00\x00' = ModbusPDU04ReadInputRegistersResponse minimal parameters -str(ModbusPDU04ReadInputRegistersResponse(registerVal=[0x01, 0x02])) == '\x04\x04\x00\x01\x00\x02' +str(ModbusPDU04ReadInputRegistersResponse(registerVal=[0x01, 0x02])) == b'\x04\x04\x00\x01\x00\x02' = ModbusPDU04ReadInputRegistersError -str(ModbusPDU04ReadInputRegistersError()) == '\x84\x01' +str(ModbusPDU04ReadInputRegistersError()) == b'\x84\x01' # 0x05/0x85 Write Single Coil ------------------------------------------------------- = ModbusPDU05WriteSingleCoilRequest -str(ModbusPDU05WriteSingleCoilRequest()) == '\x05\x00\x00\x00\x00' +str(ModbusPDU05WriteSingleCoilRequest()) == b'\x05\x00\x00\x00\x00' = ModbusPDU05WriteSingleCoilResponse -str(ModbusPDU05WriteSingleCoilResponse()) == '\x05\x00\x00\x00\x00' +str(ModbusPDU05WriteSingleCoilResponse()) == b'\x05\x00\x00\x00\x00' = ModbusPDU05WriteSingleCoilError -str(ModbusPDU05WriteSingleCoilError()) == '\x85\x01' +str(ModbusPDU05WriteSingleCoilError()) == b'\x85\x01' # 0x06/0x86 Write Single Register --------------------------------------------------- = ModbusPDU06WriteSingleRegisterError -str(ModbusPDU06WriteSingleRegisterRequest()) == '\x06\x00\x00\x00\x00' +str(ModbusPDU06WriteSingleRegisterRequest()) == b'\x06\x00\x00\x00\x00' = ModbusPDU06WriteSingleRegisterResponse -str(ModbusPDU06WriteSingleRegisterResponse()) == '\x06\x00\x00\x00\x00' +str(ModbusPDU06WriteSingleRegisterResponse()) == b'\x06\x00\x00\x00\x00' = ModbusPDU06WriteSingleRegisterError -str(ModbusPDU06WriteSingleRegisterError()) == '\x86\x01' +str(ModbusPDU06WriteSingleRegisterError()) == b'\x86\x01' # 0x07/0x87 Read Exception Status (serial line only) -------------------------------- # 0x08/0x88 Diagnostics (serial line only) ------------------------------------------ @@ -158,127 +158,127 @@ str(ModbusPDU06WriteSingleRegisterError()) == '\x86\x01' = ModbusPDU0FWriteMultipleCoilsRequest str(ModbusPDU0FWriteMultipleCoilsRequest()) = ModbusPDU0FWriteMultipleCoilsRequest minimal parameters -str(ModbusPDU0FWriteMultipleCoilsRequest(outputsValue=[0x01, 0x01])) == '\x0f\x00\x00\x00\x01\x02\x01\x01' +str(ModbusPDU0FWriteMultipleCoilsRequest(outputsValue=[0x01, 0x01])) == b'\x0f\x00\x00\x00\x01\x02\x01\x01' = ModbusPDU0FWriteMultipleCoilsResponse -str(ModbusPDU0FWriteMultipleCoilsResponse()) == '\x0f\x00\x00\x00\x01' +str(ModbusPDU0FWriteMultipleCoilsResponse()) == b'\x0f\x00\x00\x00\x01' = ModbusPDU0FWriteMultipleCoilsError -str(ModbusPDU0FWriteMultipleCoilsError()) == '\x8f\x01' +str(ModbusPDU0FWriteMultipleCoilsError()) == b'\x8f\x01' # 0x10/0x90 Write Multiple Registers ---------------------------------------------------- = ModbusPDU10WriteMultipleRegistersRequest -str(ModbusPDU10WriteMultipleRegistersRequest()) == '\x10\x00\x00\x00\x01\x02\x00\x00' +str(ModbusPDU10WriteMultipleRegistersRequest()) == b'\x10\x00\x00\x00\x01\x02\x00\x00' = ModbusPDU10WriteMultipleRegistersRequest minimal parameters -str(ModbusPDU10WriteMultipleRegistersRequest(outputsValue=[0x0001, 0x0002])) == '\x10\x00\x00\x00\x02\x04\x00\x01\x00\x02' +str(ModbusPDU10WriteMultipleRegistersRequest(outputsValue=[0x0001, 0x0002])) == b'\x10\x00\x00\x00\x02\x04\x00\x01\x00\x02' = ModbusPDU10WriteMultipleRegistersResponse -str(ModbusPDU10WriteMultipleRegistersResponse()) == '\x10\x00\x00\x00\x01' +str(ModbusPDU10WriteMultipleRegistersResponse()) == b'\x10\x00\x00\x00\x01' = ModbusPDU10WriteMultipleRegistersError -str(ModbusPDU10WriteMultipleRegistersError()) == '\x90\x01' +str(ModbusPDU10WriteMultipleRegistersError()) == b'\x90\x01' # 0x11/91 Report Server ID: serial line only ---------------------------------------- # 0x14/944 Read File Record --------------------------------------------------------- = ModbusPDU14ReadFileRecordRequest len parameters -str(ModbusPDU14ReadFileRecordRequest()/ModbusReadFileSubRequest()/ModbusReadFileSubRequest()) == '\x14\x0e\x06\x00\x01\x00\x00\x00\x01\x06\x00\x01\x00\x00\x00\x01' +str(ModbusPDU14ReadFileRecordRequest()/ModbusReadFileSubRequest()/ModbusReadFileSubRequest()) == b'\x14\x0e\x06\x00\x01\x00\x00\x00\x01\x06\x00\x01\x00\x00\x00\x01' = ModbusPDU14ReadFileRecordRequest minimal parameters -str(ModbusPDU14ReadFileRecordRequest()/ModbusReadFileSubRequest(fileNumber=4, recordNumber=1, recordLength=02)/ModbusReadFileSubRequest(fileNumber=3, recordNumber=9, recordLength=2)) == '\x14\x0e\x06\x00\x04\x00\x01\x00\x02\x06\x00\x03\x00\t\x00\x02' +str(ModbusPDU14ReadFileRecordRequest()/ModbusReadFileSubRequest(fileNumber=4, recordNumber=1, recordLength=02)/ModbusReadFileSubRequest(fileNumber=3, recordNumber=9, recordLength=2)) == b'\x14\x0e\x06\x00\x04\x00\x01\x00\x02\x06\x00\x03\x00\t\x00\x02' = ModbusPDU14ReadFileRecordRequest dissection -p = ModbusPDU14ReadFileRecordRequest('\x14\x0e\x06\x00\x04\x00\x01\x00\x02\x06\x00\x03\x00\t\x00\x02') +p = ModbusPDU14ReadFileRecordRequest(b'\x14\x0e\x06\x00\x04\x00\x01\x00\x02\x06\x00\x03\x00\t\x00\x02') assert(isinstance(p.payload, ModbusReadFileSubRequest)) assert(isinstance(p.payload.payload, ModbusReadFileSubRequest)) = ModbusPDU14ReadFileRecordResponse minimal parameters -str(ModbusPDU14ReadFileRecordResponse()/ModbusReadFileSubResponse(recData=[0x0dfe, 0x0020])/ModbusReadFileSubResponse(recData=[0x33cd, 0x0040])) == '\x14\x0c\x05\x06\r\xfe\x00 \x05\x063\xcd\x00@' +str(ModbusPDU14ReadFileRecordResponse()/ModbusReadFileSubResponse(recData=[0x0dfe, 0x0020])/ModbusReadFileSubResponse(recData=[0x33cd, 0x0040])) == b'\x14\x0c\x05\x06\r\xfe\x00 \x05\x063\xcd\x00@' = ModbusPDU14ReadFileRecordResponse dissection -p = ModbusPDU14ReadFileRecordResponse('\x14\x0c\x05\x06\r\xfe\x00 \x05\x063\xcd\x00@') +p = ModbusPDU14ReadFileRecordResponse(b'\x14\x0c\x05\x06\r\xfe\x00 \x05\x063\xcd\x00@') assert(isinstance(p.payload, ModbusReadFileSubResponse)) assert(isinstance(p.payload.payload, ModbusReadFileSubResponse)) = ModbusPDU14ReadFileRecordError -str(ModbusPDU14ReadFileRecordError()) == '\x94\x01' +str(ModbusPDU14ReadFileRecordError()) == b'\x94\x01' # 0x15/0x95 Write File Record ------------------------------------------------------- = ModbusPDU15WriteFileRecordRequest minimal parameters -str(ModbusPDU15WriteFileRecordRequest()/ModbusWriteFileSubRequest(fileNumber=4, recordNumber=07, recordData=[0x06af, 0x04be, 0x100d])) == '\x15\r\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r' +str(ModbusPDU15WriteFileRecordRequest()/ModbusWriteFileSubRequest(fileNumber=4, recordNumber=07, recordData=[0x06af, 0x04be, 0x100d])) == b'\x15\r\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r' = ModbusPDU15WriteFileRecordRequest dissection -p = ModbusPDU15WriteFileRecordRequest('\x15\x0d\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r') +p = ModbusPDU15WriteFileRecordRequest(b'\x15\x0d\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r') assert(isinstance(p.payload, ModbusWriteFileSubRequest)) assert(p.payload.recordLength == 3) = ModbusPDU15WriteFileRecordResponse minimal parameters -str(ModbusPDU15WriteFileRecordResponse()/ModbusWriteFileSubResponse(fileNumber=4, recordNumber=07, recordData=[0x06af, 0x04be, 0x100d])) == '\x15\r\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r' +str(ModbusPDU15WriteFileRecordResponse()/ModbusWriteFileSubResponse(fileNumber=4, recordNumber=07, recordData=[0x06af, 0x04be, 0x100d])) == b'\x15\r\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r' = ModbusPDU15WriteFileRecordResponse dissection -p = ModbusPDU15WriteFileRecordResponse('\x15\x0d\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r') +p = ModbusPDU15WriteFileRecordResponse(b'\x15\x0d\x06\x00\x04\x00\x07\x00\x03\x06\xaf\x04\xbe\x10\r') assert(isinstance(p.payload, ModbusWriteFileSubResponse)) assert(p.payload.recordLength == 3) = ModbusPDU15WriteFileRecordError -str(ModbusPDU15WriteFileRecordError()) == '\x95\x01' +str(ModbusPDU15WriteFileRecordError()) == b'\x95\x01' # 0x16/0x96 Mask Write Register ----------------------------------------------------- = ModbusPDU16MaskWriteRegisterRequest -str(ModbusPDU16MaskWriteRegisterRequest()) == '\x16\x00\x00\xff\xff\x00\x00' +str(ModbusPDU16MaskWriteRegisterRequest()) == b'\x16\x00\x00\xff\xff\x00\x00' = ModbusPDU16MaskWriteRegisterResponse -str(ModbusPDU16MaskWriteRegisterResponse()) == '\x16\x00\x00\xff\xff\x00\x00' +str(ModbusPDU16MaskWriteRegisterResponse()) == b'\x16\x00\x00\xff\xff\x00\x00' = ModbusPDU16MaskWriteRegisterError -str(ModbusPDU16MaskWriteRegisterError()) == '\x96\x01' +str(ModbusPDU16MaskWriteRegisterError()) == b'\x96\x01' # 0x17/0x97 Read/Write Multiple Registers ------------------------------------------- = ModbusPDU17ReadWriteMultipleRegistersRequest -str(ModbusPDU17ReadWriteMultipleRegistersRequest()) == '\x17\x00\x00\x00\x01\x00\x00\x00\x01\x02\x00\x00' +str(ModbusPDU17ReadWriteMultipleRegistersRequest()) == b'\x17\x00\x00\x00\x01\x00\x00\x00\x01\x02\x00\x00' = ModbusPDU17ReadWriteMultipleRegistersRequest minimal parameters -str(ModbusPDU17ReadWriteMultipleRegistersRequest(writeRegistersValue=[0x0001, 0x0002])) == '\x17\x00\x00\x00\x01\x00\x00\x00\x02\x04\x00\x01\x00\x02' +str(ModbusPDU17ReadWriteMultipleRegistersRequest(writeRegistersValue=[0x0001, 0x0002])) == b'\x17\x00\x00\x00\x01\x00\x00\x00\x02\x04\x00\x01\x00\x02' = ModbusPDU17ReadWriteMultipleRegistersRequest dissection -p = ModbusPDU17ReadWriteMultipleRegistersRequest('\x17\x00\x00\x00\x01\x00\x00\x00\x02\x04\x00\x01\x00\x02') +p = ModbusPDU17ReadWriteMultipleRegistersRequest(b'\x17\x00\x00\x00\x01\x00\x00\x00\x02\x04\x00\x01\x00\x02') assert(p.byteCount == 4) assert(p.writeQuantityRegisters == 2) = ModbusPDU17ReadWriteMultipleRegistersResponse -str(ModbusPDU17ReadWriteMultipleRegistersResponse()) == '\x17\x02\x00\x00' +str(ModbusPDU17ReadWriteMultipleRegistersResponse()) == b'\x17\x02\x00\x00' = ModbusPDU17ReadWriteMultipleRegistersResponse minimal parameters -str(ModbusPDU17ReadWriteMultipleRegistersResponse(registerVal=[1,2,3])) == '\x17\x06\x00\x01\x00\x02\x00\x03' +str(ModbusPDU17ReadWriteMultipleRegistersResponse(registerVal=[1,2,3])) == b'\x17\x06\x00\x01\x00\x02\x00\x03' = ModbusPDU17ReadWriteMultipleRegistersResponse dissection -str(ModbusPDU17ReadWriteMultipleRegistersResponse('\x17\x02\x00\x01')) == '\x17\x02\x00\x01' +str(ModbusPDU17ReadWriteMultipleRegistersResponse(b'\x17\x02\x00\x01')) == b'\x17\x02\x00\x01' = ModbusPDU17ReadWriteMultipleRegistersError -str(ModbusPDU17ReadWriteMultipleRegistersError()) == '\x97\x01' +str(ModbusPDU17ReadWriteMultipleRegistersError()) == b'\x97\x01' # 0x18/0x88 Read FIFO Queue --------------------------------------------------------- = ModbusPDU18ReadFIFOQueueRequest -str(ModbusPDU18ReadFIFOQueueRequest()) == '\x18\x00\x00' +str(ModbusPDU18ReadFIFOQueueRequest()) == b'\x18\x00\x00' = ModbusPDU18ReadFIFOQueueResponse = ModbusPDU18ReadFIFOQueueResponse -str(ModbusPDU18ReadFIFOQueueResponse()) == '\x18\x00\x02\x00\x00' +str(ModbusPDU18ReadFIFOQueueResponse()) == b'\x18\x00\x02\x00\x00' = ModbusPDU18ReadFIFOQueueResponse minimal parameters -str(ModbusPDU18ReadFIFOQueueResponse(FIFOVal=[0x0001, 0x0002, 0x0003])) == '\x18\x00\x08\x00\x03\x00\x01\x00\x02\x00\x03' +str(ModbusPDU18ReadFIFOQueueResponse(FIFOVal=[0x0001, 0x0002, 0x0003])) == b'\x18\x00\x08\x00\x03\x00\x01\x00\x02\x00\x03' = ModbusPDU18ReadFIFOQueueResponse dissection -p = ModbusPDU18ReadFIFOQueueResponse('\x18\x00\x08\x00\x03\x00\x01\x00\x02\x00\x03') +p = ModbusPDU18ReadFIFOQueueResponse(b'\x18\x00\x08\x00\x03\x00\x01\x00\x02\x00\x03') assert(p.byteCount == 8) assert(p.FIFOCount == 3) = ModbusPDU18ReadFIFOQueueError -str(ModbusPDU18ReadFIFOQueueError()) == '\x98\x01' +str(ModbusPDU18ReadFIFOQueueError()) == b'\x98\x01' # 0x2b encapsulated Interface Transport --------------------------------------------- # 0x2b 0xOD CANopen General Reference (out of the main specification) --------------- # 0x2b 0xOE Read Device Information ------------------------------------------------- = ModbusPDU2B0EReadDeviceIdentificationRequest -str(ModbusPDU2B0EReadDeviceIdentificationRequest()) =='+\x0e\x01\x00' +str(ModbusPDU2B0EReadDeviceIdentificationRequest()) ==b'+\x0e\x01\x00' = ModbusPDU2B0EReadDeviceIdentificationResponse -str(ModbusPDU2B0EReadDeviceIdentificationResponse()) == '+\x0e\x04\x01\x00\x00\x00' +str(ModbusPDU2B0EReadDeviceIdentificationResponse()) == b'+\x0e\x04\x01\x00\x00\x00' = ModbusPDU2B0EReadDeviceIdentificationResponse dissection -p = ModbusPDU2B0EReadDeviceIdentificationResponse('+\x0e\x01\x83\x00\x00\x03\x00\x08Pymodbus\x01\x02PM\x02\x031.0') +p = ModbusPDU2B0EReadDeviceIdentificationResponse(b'+\x0e\x01\x83\x00\x00\x03\x00\x08Pymodbus\x01\x02PM\x02\x031.0') assert(p.payload.payload.payload.id == 2) assert(p.payload.payload.id == 1) assert(p.payload.id == 0) = ModbusPDU2B0EReadDeviceIdentificationError -str(ModbusPDU2B0EReadDeviceIdentificationError()) == '\xab\x01' +str(ModbusPDU2B0EReadDeviceIdentificationError()) == b'\xab\x01' diff --git a/scapy/contrib/nsh.uts b/scapy/contrib/nsh.uts index 81f7af3fbfe7e59be929ed9715cff0bdf03953da..246d74f4aca2e6e08effb41eccaa67c5b600b1f0 100644 --- a/scapy/contrib/nsh.uts +++ b/scapy/contrib/nsh.uts @@ -8,7 +8,7 @@ from scapy.contrib.nsh import * + Basic Layer Tests = Build a NSH over NSH packet with NSP=42, and NSI=1 -str(NSH(Len=2, NSP=42, NSI=1)/NSH()) == '\x00\x02\x01\x04\x00\x00*\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(NSH(Len=2, NSP=42, NSI=1)/NSH()) == b'\x00\x02\x01\x04\x00\x00*\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = Build a Ethernet over NSH over Ethernet packet (NSH over Ethernet encapsulating the original packet) and verify Ethernet Bindings -str(Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/NSH()/Ether(src="00:00:00:00:00:03", dst="00:00:00:00:00:04")/ARP(psrc="10.0.0.1", hwsrc="00:00:00:00:00:01")) == '\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x01\x89O\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x03\x08\x06\x00\x01\x08\x00\x06\x04\x00\x01\x00\x00\x00\x00\x00\x01\n\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(Ether(src="00:00:00:00:00:01", dst="00:00:00:00:00:02")/NSH()/Ether(src="00:00:00:00:00:03", dst="00:00:00:00:00:04")/ARP(psrc="10.0.0.1", hwsrc="00:00:00:00:00:01")) == b'\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x01\x89O\x00\x00\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x03\x08\x06\x00\x01\x08\x00\x06\x04\x00\x01\x00\x00\x00\x00\x00\x01\n\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' diff --git a/scapy/contrib/openflow.uts b/scapy/contrib/openflow.uts index a26af678b819990044b337f2703995ea4db60384..dd2d0bf6470e7e4eae0423b598622f7c307b96e8 100755 --- a/scapy/contrib/openflow.uts +++ b/scapy/contrib/openflow.uts @@ -4,11 +4,11 @@ = OFPTHello(), simple hello message ofm = OFPTHello() -str(ofm) == '\x01\x00\x00\x08\x00\x00\x00\x00' +str(ofm) == b'\x01\x00\x00\x08\x00\x00\x00\x00' = OFPTEchoRequest(), echo request ofm = OFPTEchoRequest() -str(ofm) == '\x01\x02\x00\x08\x00\x00\x00\x00' +str(ofm) == b'\x01\x02\x00\x08\x00\x00\x00\x00' = OFPMatch(), check wildcard completion ofm = OFPMatch(in_port=1, nw_tos=8) @@ -37,14 +37,14 @@ act2 = OFPATOutput(port='CONTROLLER') act3 = OFPATSetDlSrc(dl_addr='1a:d5:cb:4e:3c:64') ofm = OFPTFlowMod(priority=1000, match=mtc, flags='CHECK_OVERLAP', actions=[act1,act2,act3]) str(ofm) -s = '\x01\x0e\x00h\x00\x00\x00\x00\x00?\xc8\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xe8\xff\xff\xff\xff\xff\xff\x00\x02\x00\x06\x00\x08\xc0\xa8*\x01\x00\x00\x00\x08\xff\xfd\xff\xff\x00\x04\x00\x10\x1a\xd5\xcbN<d\x00\x00\x00\x00\x00\x00' +s = b'\x01\x0e\x00h\x00\x00\x00\x00\x00?\xc8\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xe8\xff\xff\xff\xff\xff\xff\x00\x02\x00\x06\x00\x08\xc0\xa8*\x01\x00\x00\x00\x08\xff\xfd\xff\xff\x00\x04\x00\x10\x1a\xd5\xcbN<d\x00\x00\x00\x00\x00\x00' str(ofm) == s = OFPETBadRequest() containing a flow_mod with wrong table_id flowmod = OFPTFlowMod(actions=OFPATOutput(port='LOCAL')) ofm = OFPETBadRequest(errcode='OFPBRC_EPERM', data=str(flowmod)) hexdump(ofm) -s = '\x01\x01\x00\\\x00\x00\x00\x00\x00\x01\x00\x05\x01\x0e\x00P\x00\x00\x00\x00\x00?\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x08\xff\xfe\xff\xff' +s = b'\x01\x01\x00\\\x00\x00\x00\x00\x00\x01\x00\x05\x01\x0e\x00P\x00\x00\x00\x00\x00?\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x08\xff\xfe\xff\xff' str(ofm) == s = OFPTPacketIn() containing an Ethernet frame @@ -73,7 +73,7 @@ isinstance(p[TCP].payload, OFPTHello) = complete Ether()/IP()/TCP()/OFPTFeaturesRequest() ofm = Ether(src='00:11:22:33:44:55',dst='01:23:45:67:89:ab')/IP(src='10.0.0.7',dst='192.168.0.42')/TCP(sport=6633)/OFPTFeaturesRequest(xid=23) -s = '\x01#Eg\x89\xab\x00\x11"3DU\x08\x00E\x00\x000\x00\x01\x00\x00@\x06\xaf\xee\n\x00\x00\x07\xc0\xa8\x00*\x19\xe9\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa9\xa4\x00\x00\x01\x05\x00\x08\x00\x00\x00\x17' +s = b'\x01#Eg\x89\xab\x00\x11"3DU\x08\x00E\x00\x000\x00\x01\x00\x00@\x06\xaf\xee\n\x00\x00\x07\xc0\xa8\x00*\x19\xe9\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa9\xa4\x00\x00\x01\x05\x00\x08\x00\x00\x00\x17' assert(str(ofm) == s) e = Ether(s) e.show2() diff --git a/scapy/contrib/openflow3.py b/scapy/contrib/openflow3.py index 9ef88587def5ea291872e34b3176f80911688122..48f83b4df380ad2e74064569f1539efdf8b3fabd 100755 --- a/scapy/contrib/openflow3.py +++ b/scapy/contrib/openflow3.py @@ -642,7 +642,7 @@ class OFPMatch(Packet): l = len(p)+len(pay) p = p[:2] + struct.pack("!H", l) + p[4:] zero_bytes = (8 - l%8) % 8 - p += "\x00" * zero_bytes + p += b"\x00" * zero_bytes # message with user-defined length will not be automatically padded return p + pay @@ -914,7 +914,7 @@ class OFPATSetField(_ofp_action_header): else: zero_bytes = (8 - l%8) % 8 # every message will be padded correctly - p += "\x00" * zero_bytes + p += b"\x00" * zero_bytes return p + pay def extract_padding(self, s): @@ -2835,7 +2835,7 @@ class _ofp_table_features_prop_header(Packet): p = p[:2] + struct.pack("!H", l) + p[4:] # every message will be padded correctly zero_bytes = (8 - l%8) % 8 - p += "\x00" * zero_bytes + p += b"\x00" * zero_bytes return p + pay def extract_padding(self, s): diff --git a/scapy/contrib/openflow3.uts b/scapy/contrib/openflow3.uts index 7984fa56aa3ba87faf814cb310c1197f1bbabe55..0fb844ac548bedd4b189a3384166687dcbfab1e5 100755 --- a/scapy/contrib/openflow3.uts +++ b/scapy/contrib/openflow3.uts @@ -4,16 +4,16 @@ = OFPTHello(), hello without version bitmap ofm = OFPTHello() -str(ofm) == '\x04\x00\x00\x08\x00\x00\x00\x00' +str(ofm) == b'\x04\x00\x00\x08\x00\x00\x00\x00' = OFPTEchoRequest(), echo request ofm = OFPTEchoRequest() -str(ofm) == '\x04\x02\x00\x08\x00\x00\x00\x00' +str(ofm) == b'\x04\x02\x00\x08\x00\x00\x00\x00' = OFPMatch(), check padding ofm = OFPMatch(oxm_fields=OFBEthType(eth_type=0x86dd)) assert(len(str(ofm))%8 == 0) -str(ofm) == '\x00\x01\x00\x0a\x80\x00\x0a\x02\x86\xdd\x00\x00\x00\x00\x00\x00' +str(ofm) == b'\x00\x01\x00\x0a\x80\x00\x0a\x02\x86\xdd\x00\x00\x00\x00\x00\x00' = OpenFlow(), generic method test with OFPTEchoRequest() ofm = OFPTEchoRequest() @@ -39,14 +39,14 @@ ist1 = OFPITApplyActions(actions=[OFPATSetField(field=OFBIPv4Src(ipv4_src='192.1 ist2 = OFPITWriteActions(actions=OFPATOutput(port='CONTROLLER')) ofm = OFPTFlowMod(table_id=2, match=mtc, instructions=[ist1,ist2]) hexdump(ofm) -s = '\x04\x0e\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00\x0a\x80\x00\x0c\x02\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x04\x00\x38\x00\x00\x00\x00\x00\x19\x00\x10\x80\x00\x16\x04\xc0\xa8\x0a\x29\x00\x00\x00\x00\x00\x19\x00\x10\x80\x00\x08\x06\x1a\xd5\xcb\x4e\x3c\x64\x00\x00\x00\x00\x00\x10\xff\xff\xff\xfa\xff\xff\x00\x00\x00\x00\x00\x00\x00\x03\x00\x18\x00\x00\x00\x00\x00\x00\x00\x10\xff\xff\xff\xfd\xff\xff\x00\x00\x00\x00\x00\x00' +s = b'\x04\x0e\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00\x0a\x80\x00\x0c\x02\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x04\x00\x38\x00\x00\x00\x00\x00\x19\x00\x10\x80\x00\x16\x04\xc0\xa8\x0a\x29\x00\x00\x00\x00\x00\x19\x00\x10\x80\x00\x08\x06\x1a\xd5\xcb\x4e\x3c\x64\x00\x00\x00\x00\x00\x10\xff\xff\xff\xfa\xff\xff\x00\x00\x00\x00\x00\x00\x00\x03\x00\x18\x00\x00\x00\x00\x00\x00\x00\x10\xff\xff\xff\xfd\xff\xff\x00\x00\x00\x00\x00\x00' str(ofm) == s = OFPETBadRequest() containing a flow_mod with wrong table_id flowmod = OFPTFlowMod(instructions=OFPITGotoTable(table_id=0)) ofm = OFPETBadRequest(errcode='OFPBRC_BAD_TABLE_ID', data=str(flowmod)) hexdump(ofm) -s = '\x04\x01\x00L\x00\x00\x00\x00\x00\x01\x00\t\x04\x0e\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x01\x00\x08\x00\x00\x00\x00' +s = b'\x04\x01\x00L\x00\x00\x00\x00\x00\x01\x00\t\x04\x0e\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x01\x00\x08\x00\x00\x00\x00' str(ofm) == s = OFPTPacketIn() containing an Ethernet frame @@ -75,7 +75,7 @@ isinstance(p[TCP].payload, OFPTHello) = complete Ether()/IP()/TCP()/OFPTFeaturesRequest() ofm = Ether(src='00:11:22:33:44:55',dst='01:23:45:67:89:ab')/IP(src='10.0.0.7',dst='192.168.0.42')/TCP(sport=6633)/OFPTFeaturesRequest(xid=23) -s = '\x01#Eg\x89\xab\x00\x11"3DU\x08\x00E\x00\x000\x00\x01\x00\x00@\x06\xaf\xee\n\x00\x00\x07\xc0\xa8\x00*\x19\xe9\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa6\xa4\x00\x00\x04\x05\x00\x08\x00\x00\x00\x17' +s = b'\x01#Eg\x89\xab\x00\x11"3DU\x08\x00E\x00\x000\x00\x01\x00\x00@\x06\xaf\xee\n\x00\x00\x07\xc0\xa8\x00*\x19\xe9\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa6\xa4\x00\x00\x04\x05\x00\x08\x00\x00\x00\x17' assert(str(ofm) == s) e = Ether(s) e.show2() diff --git a/scapy/contrib/ospf.py b/scapy/contrib/ospf.py index 83acc19da584a1de2736ccf5b1d72c8f8c8c085e..15b2d5e9a22f87449f87a59ca05d58c1097478cb 100644 --- a/scapy/contrib/ospf.py +++ b/scapy/contrib/ospf.py @@ -149,8 +149,8 @@ class LLS_Crypto_Auth(LLS_Generic_TLV): name = "LLS Cryptographic Authentication" fields_desc = [ShortField("type", 2), FieldLenField("len", 20, fmt="B", length_of=lambda x: x.authdata), - XIntField("sequence", "\x00\x00\x00\x00"), - StrLenField("authdata", "\x00" * 16, length_from=lambda x: x.len)] + XIntField("sequence", b"\x00\x00\x00\x00"), + StrLenField("authdata", b"\x00" * 16, length_from=lambda x: x.len)] def post_build(self, p, pay): p += pay @@ -213,7 +213,7 @@ _OSPF_LSclasses = {1: "OSPF_Router_LSA", def ospf_lsa_checksum(lsa): - return fletcher16_checkbytes("\x00\x00" + lsa[2:], 16) # leave out age + return fletcher16_checkbytes(b"\x00\x00" + lsa[2:], 16) # leave out age class OSPF_LSA_Hdr(Packet): diff --git a/scapy/contrib/pnio.uts b/scapy/contrib/pnio.uts index 7cd9d53457bf73756459e4a225391b1da0b32d99..979ed70a68676f5fb1de8f8d18fc5ad304988906 100644 --- a/scapy/contrib/pnio.uts +++ b/scapy/contrib/pnio.uts @@ -8,7 +8,7 @@ from scapy.contrib.pnio import * + Check DCE/RPC layer = ProfinetIO default values -str(ProfinetIO()) == '\x00\x00' +str(ProfinetIO()) == b'\x00\x00' = ProfinetIO overloads Ethertype p = Ether() / ProfinetIO() diff --git a/scapy/contrib/pnio_rtc.py b/scapy/contrib/pnio_rtc.py index 026b6e0f870a4de05a2ad10adfeef126c291f0df..6c9d73791a3d865d29aa755d6b25263b12146f18 100644 --- a/scapy/contrib/pnio_rtc.py +++ b/scapy/contrib/pnio_rtc.py @@ -72,7 +72,7 @@ class PNIORealTimeRawData(Packet): def __init__(self, _pkt="", post_transform=None, _internal=0, _underlayer=None, config=None, **fields): """ length=None means that the length must be managed by the user. If it's - defined, the field will always be length-long (padded with "\\x00" if + defined, the field will always be length-long (padded with b"\\x00" if needed) """ self._config = config @@ -205,7 +205,7 @@ class PNIORealTime(Packet): name = "PROFINET Real-Time" fields_desc = [ NotionalLenField("len", None, length_from=lambda p, s: len(s)), - NotionalLenField("dataLen", None, length_from=lambda p, s: len(s[:-4].rstrip("\0"))), + NotionalLenField("dataLen", None, length_from=lambda p, s: len(s[:-4].rstrip(b"\0"))), LowerLayerBoundPacketListField("data", [], _pnio_rtc_guess_payload_class, length_from=lambda p: p.dataLen), StrFixedLenField("padding", "", length_from=lambda p: p[PNIORealTime].padding_length()), ShortField("cycleCounter", 0), @@ -252,7 +252,7 @@ class PNIORealTime(Packet): # 0x80 are mainly IOxS and trailling 0x00s are just padding for pkt in packets: if PNIORealTime in pkt: - pdu = bytes(pkt[PNIORealTime])[:-4].rstrip("\0") + pdu = bytes(pkt[PNIORealTime])[:-4].rstrip(b"\0") if (pkt.src, pkt.dst) not in heuristic: heuristic[(pkt.src, pkt.dst)] = (0, []) @@ -263,7 +263,7 @@ class PNIORealTime(Packet): counts.extend([0 for _ in range(len(pdu) - len(counts))]) for i in range(len(pdu)): - if pdu[i] != "\x80": + if pdu[i] != b"\x80": counts[i] += 1 comm = (pkt.src, pkt.dst) @@ -367,7 +367,7 @@ class PNIORealTime(Packet): for pkt in packets: if PNIORealTime in pkt and (pkt.src, pkt.dst) == comm: comm_packets.append( - bytes(pkt[PNIORealTime])[:-4].rstrip("\0") + bytes(pkt[PNIORealTime])[:-4].rstrip(b"\0") ) # Get the entropy @@ -450,7 +450,7 @@ class XVarBytesField(XByteField): def getfield(self, pkt, s): length = self.length_from(pkt) - val = struct.unpack(self.fmt, "\x00"*(8 - length) + s[:length])[0] + val = struct.unpack(self.fmt, b"\x00"*(8 - length) + s[:length])[0] return s[length:], self.m2i(pkt, val) diff --git a/scapy/contrib/pnio_rtc.uts b/scapy/contrib/pnio_rtc.uts index cca475a2d1476f2ff5e9cb5389be06e4e7974e5d..76f33edd8edfed0420747f69c7253bf25c9c7d4a 100644 --- a/scapy/contrib/pnio_rtc.uts +++ b/scapy/contrib/pnio_rtc.uts @@ -9,28 +9,28 @@ from scapy.contrib.pnio_rtc import * + Check PNIORealTimeIOxS = PNIORealTimeIOxS default values -str(PNIORealTimeIOxS()) == '\x80' +str(PNIORealTimeIOxS()) == b'\x80' = Check no payload is dissected (only padding) * In order for the PNIORealTime to dissect correctly all the data buffer, data field must strictly dissect what they know as being of themselves -p = PNIORealTimeIOxS('\x40\x01\x02') -p == PNIORealTimeIOxS(dataState='bad', instance='device') / conf.padding_layer('\x01\x02') +p = PNIORealTimeIOxS(b'\x40\x01\x02') +p == PNIORealTimeIOxS(dataState='bad', instance='device') / conf.padding_layer(b'\x01\x02') + Check PNIORealTimeRawData = PNIORealTimeRawData default values -str(PNIORealTimeRawData(config={'length': 5})) == '\x00\x00\x00\x00\x00' +str(PNIORealTimeRawData(config={'length': 5})) == b'\x00\x00\x00\x00\x00' = PNIORealTimeRawData must always be the same configured length -str(PNIORealTimeRawData(load='ABC', config={'length': 5})) == 'ABC\x00\x00' +str(PNIORealTimeRawData(load='ABC', config={'length': 5})) == b'ABC\x00\x00' = PNIORealTimeRawData may be truncated str(PNIORealTimeRawData(load='ABCDEF', config={'length': 5})) == 'ABCDE' = Check that the dissected payload is an PNIORealTimeIOxS (IOPS) -p = PNIORealTimeRawData('ABCDE\x80\x01\x02', config={'length': 5}) -p == PNIORealTimeRawData(load='ABCDE', config={'length': 5}) / PNIORealTimeIOxS() / conf.padding_layer('\x01\x02') +p = PNIORealTimeRawData(b'ABCDE\x80\x01\x02', config={'length': 5}) +p == PNIORealTimeRawData(load='ABCDE', config={'length': 5}) / PNIORealTimeIOxS() / conf.padding_layer(b'\x01\x02') = PNIORealTimeRawData is capable of dissected uncomplete packets p = PNIORealTimeRawData('ABC', config={'length': 5}) @@ -40,20 +40,20 @@ p == PNIORealTimeRawData(load='ABC', config={'length': 5}) + Check Profisafe = Profisafe default values -str(Profisafe(config={'length': 7, 'CRC': 3})) == '\0\0\0\0\0\0\0' +str(Profisafe(config={'length': 7, 'CRC': 3})) == b'\0\0\0\0\0\0\0' = Profisafe must always be the same configured length -str(Profisafe(load='AB', config={'length': 7, 'CRC': 3})) == 'AB\0\0\0\0\0' +str(Profisafe(load='AB', config={'length': 7, 'CRC': 3})) == b'AB\0\0\0\0\0' = Profisafe load may be truncated -str(Profisafe(load='ABCDEF', config={'length': 7, 'CRC': 3})) == 'ABC\0\0\0\0' +str(Profisafe(load='ABCDEF', config={'length': 7, 'CRC': 3})) == b'ABC\0\0\0\0' = Check that the dissected payload is an PNIORealTimeIOxS (IOPS) -p = Profisafe('ABC\x20\x12\x34\x56\x80\x01\x02', config={'length': 7, 'CRC': 3}) -p == Profisafe(load='ABC', Control_Status=0x20, CRC=0x123456, config={'length': 7, 'CRC': 3}) / PNIORealTimeIOxS() / conf.padding_layer('\x01\x02') +p = Profisafe(b'ABC\x20\x12\x34\x56\x80\x01\x02', config={'length': 7, 'CRC': 3}) +p == Profisafe(load='ABC', Control_Status=0x20, CRC=0x123456, config={'length': 7, 'CRC': 3}) / PNIORealTimeIOxS() / conf.padding_layer(b'\x01\x02') = Profisafe with a CRC-32 -str(Profisafe(load='ABC', Control_Status=0x33, CRC=0x12345678, config={'length': 8, 'CRC': 4})) == 'ABC\x33\x12\x34\x56\x78' +str(Profisafe(load='ABC', Control_Status=0x33, CRC=0x12345678, config={'length': 8, 'CRC': 4})) == b'ABC\x33\x12\x34\x56\x78' = Profisafe is capable of dissected uncomplete packets p = Profisafe('AB', config={'length': 7, 'CRC': 3}) @@ -63,24 +63,24 @@ p == Profisafe(load='AB', Control_Status=0, CRC=0) + Check PNIORealTime layer = PNIORealTime default values -str(PNIORealTime()) == '\0' * 40 + '\0\0\x35\0' +str(PNIORealTime()) == b'\0' * 40 + b'\0\0\x35\0' = PNIORealTime default values under an UDP packet -str(UDP(sport=0x1234) / ProfinetIO(frameID=0x8002) / PNIORealTime()) == '12348892001a00008002'.decode('hex') + '\0' * 12 + '\0\0\x35\0' +str(UDP(sport=0x1234) / ProfinetIO(frameID=0x8002) / PNIORealTime()) == '12348892001a00008002'.decode('hex') + b'\0' * 12 + b'\0\0\x35\0' = PNIORealTime simple packet * a simple data packet with a raw profinet data and its IOPS, an IOCS and a Profisafe data and its IOPS. 15B data length, 1B padding (20 - 15 -4) str(PNIORealTime(len=20, dataLen=15, cycleCounter=0x1234, dataStatus='redundancy+validData+no_problem', transferStatus=3, data=[ - PNIORealTimeRawData(load='\x01\x02\x03\x04', config={'length': 5}) / PNIORealTimeIOxS(), + PNIORealTimeRawData(load=b'\x01\x02\x03\x04', config={'length': 5}) / PNIORealTimeIOxS(), PNIORealTimeIOxS(dataState='bad'), - Profisafe(load='\x05\x06', Control_Status=0x20, CRC=0x12345678, config={'length': 7, 'CRC': 4}) / PNIORealTimeIOxS() + Profisafe(load=b'\x05\x06', Control_Status=0x20, CRC=0x12345678, config={'length': 7, 'CRC': 4}) / PNIORealTimeIOxS() ] )) == '0102030400800005062012345678800012342603'.decode('hex') = PNIORealTime dissects to PNIORealTimeRawData when no config is available p = PNIORealTime('0102030400800005062012345678800012342603'.decode('hex')) -p == PNIORealTime(len=20, dataLen=15, cycleCounter=0x1234, dataStatus='redundancy+validData+no_problem', transferStatus=3, padding='\0', +p == PNIORealTime(len=20, dataLen=15, cycleCounter=0x1234, dataStatus='redundancy+validData+no_problem', transferStatus=3, padding=b'\0', data=[ PNIORealTimeRawData(load='010203040080000506201234567880'.decode('hex')) ] @@ -96,11 +96,11 @@ pnio_update_config({ }) p = Ether('000102030405060708090a0b889280020102030400800005062012345678800012342603'.decode('hex')) p == Ether(dst='00:01:02:03:04:05', src='06:07:08:09:0a:0b') / ProfinetIO(frameID=0x8002) / PNIORealTime( - len=20, dataLen=15, cycleCounter=0x1234, dataStatus='redundancy+validData+no_problem', transferStatus=3, padding='\0', + len=20, dataLen=15, cycleCounter=0x1234, dataStatus='redundancy+validData+no_problem', transferStatus=3, padding=b'\0', data=[ - PNIORealTimeRawData(load='\x01\x02\x03\x04\0', config={'length': 5}) / PNIORealTimeIOxS(), + PNIORealTimeRawData(load=b'\x01\x02\x03\x04\0', config={'length': 5}) / PNIORealTimeIOxS(), PNIORealTimeIOxS(dataState='bad'), - Profisafe(load='\x05\x06', Control_Status=0x20, CRC=0x12345678, config={'length': 7, 'CRC': 4}) / PNIORealTimeIOxS() + Profisafe(load=b'\x05\x06', Control_Status=0x20, CRC=0x12345678, config={'length': 7, 'CRC': 4}) / PNIORealTimeIOxS() ] ) diff --git a/scapy/contrib/ppi_geotag.uts b/scapy/contrib/ppi_geotag.uts index 96ea30fc6f86f055cfc3f1bba24e5baa23b36807..9b1f38dc4b72131d8a7bc08ab657b0880d3908b3 100644 --- a/scapy/contrib/ppi_geotag.uts +++ b/scapy/contrib/ppi_geotag.uts @@ -10,19 +10,19 @@ from scapy.contrib.ppi_geotag import * = Test GPS dissection -assert str(GPS()) == '2u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' +assert str(GPS()) == b'2u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' = Test Vector dissection -assert str(Vector()) == '3u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' +assert str(Vector()) == b'3u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' = Test Sensor dissection -assert str(Sensor()) == '4u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' +assert str(Sensor()) == b'4u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' = Test Antenna dissection -assert str(Antenna()) == '5u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' +assert str(Antenna()) == b'5u\x08\x00\x02\x00\x08\x00\x00\x00\x00\x00' = Test GPSTime_Field time handling diff --git a/scapy/contrib/rsvp.py b/scapy/contrib/rsvp.py index 208dcde983b55057db4f100e42b62da103aeac1e..e2b1247e311c628f19056e233f5bf9317bb20eaa 100644 --- a/scapy/contrib/rsvp.py +++ b/scapy/contrib/rsvp.py @@ -144,7 +144,7 @@ class RSVP_Data(Packet): class RSVP_HOP(Packet): name = "HOP" fields_desc = [ IPField("neighbor","0.0.0.0"), - BitField("inface",1,32)] + BitField("inface",1,32)] def default_payload_class(self, payload): return RSVP_Object diff --git a/scapy/contrib/skinny.py b/scapy/contrib/skinny.py index 1ed02e42f31ef4bbc6ae4f7fc97e7955dc7049a5..215602db9f97caba1af0f42d8567aefb0caecaa9 100644 --- a/scapy/contrib/skinny.py +++ b/scapy/contrib/skinny.py @@ -319,7 +319,7 @@ class SkinnyMessageSoftKeyEvent(Packet): class SkinnyMessagePromptStatus(Packet): name='Prompt status' fields_desc = [ LEIntField("timeout", 0), - StrFixedLenField("text", "\0"*32, 32), + StrFixedLenField("text", b"\0"*32, 32), LEIntField("instance", 1), LEIntField("callid", 0)] @@ -371,10 +371,10 @@ class SkinnyMessageCallInfo(Packet): StrFixedLenField("lastredirectingnum", "1034", 24), LEIntField("originalredirectreason", 0), LEIntField("lastredirectreason", 0), - StrFixedLenField('voicemailboxG', '\0'*24, 24), - StrFixedLenField('voicemailboxD', '\0'*24, 24), - StrFixedLenField('originalvoicemailboxD', '\0'*24, 24), - StrFixedLenField('lastvoicemailboxD', '\0'*24, 24), + StrFixedLenField('voicemailboxG', b'\0'*24, 24), + StrFixedLenField('voicemailboxD', b'\0'*24, 24), + StrFixedLenField('originalvoicemailboxD', b'\0'*24, 24), + StrFixedLenField('lastvoicemailboxD', b'\0'*24, 24), LEIntField('security', 0), FlagsField('restriction', 0, 16, _skinny_message_callinfo_restrictions), LEIntField('unknown', 0)] diff --git a/scapy/contrib/vtp.py b/scapy/contrib/vtp.py index 0ebb17d8227a1a570d604e1aac7cfc01fefe9b67..8c6c8d01d5b2e68b8386606a42c808e84f172f9a 100644 --- a/scapy/contrib/vtp.py +++ b/scapy/contrib/vtp.py @@ -29,7 +29,7 @@ - Have a closer look at 8 byte padding in summary adv. "debug sw-vlan vtp packets" sais the TLV length is invalid, when I change the values - '\x00\x00\x00\x01\x06\x01\x00\x02' + b'\x00\x00\x00\x01\x06\x01\x00\x02' * \x00\x00 ? * \x00\x01 tlvtype? * \x06 length? @@ -105,7 +105,7 @@ class VTPVlanInfo(Packet): # Pad vlan name with zeros if vlannamelen > len(vlanname) l = vlannamelen - len(self.vlanname) if l != 0: - p += "\x00" * l + p += b"\x00" * l p += pay @@ -149,7 +149,7 @@ class VTP(Packet): lambda pkt:pkt.code == 1), ConditionalField(VTPTimeStampField("timestamp", '930301000000'), lambda pkt:pkt.code == 1), - ConditionalField(StrFixedLenField("md5", "\x00" * 16, 16), + ConditionalField(StrFixedLenField("md5", b"\x00" * 16, 16), lambda pkt:pkt.code == 1), ConditionalField( PacketListField("vlaninfo", [], VTPVlanInfo), @@ -160,7 +160,7 @@ class VTP(Packet): def post_build(self, p, pay): if self.domnamelen == None: - domnamelen = len(self.domname.strip("\x00")) + domnamelen = len(self.domname.strip(b"\x00")) p = p[:3] + chr(domnamelen & 0xff) + p[4:] p += pay diff --git a/scapy/data.py b/scapy/data.py index b6d805361efd83d6e26f846cca42c54004071c59..65c829bb8fa76cc892efa2fbb344387b1f439a34 100644 --- a/scapy/data.py +++ b/scapy/data.py @@ -15,8 +15,8 @@ from scapy.error import log_loading ## Consts ## ############ -ETHER_ANY = "\x00"*6 -ETHER_BROADCAST = "\xff"*6 +ETHER_ANY = b"\x00"*6 +ETHER_BROADCAST = b"\xff"*6 ETH_P_ALL = 3 ETH_P_IP = 0x800 diff --git a/scapy/fields.py b/scapy/fields.py index 25dbc2ecf595736b1bf7bf7e9ebe0efa0c2076b1..0843adc42c616e55dd31bed416858de6b47efa6e 100644 --- a/scapy/fields.py +++ b/scapy/fields.py @@ -203,7 +203,7 @@ class MACField(Field): Field.__init__(self, name, default, "6s") def i2m(self, pkt, x): if x is None: - return "\0\0\0\0\0\0" + return b"\0\0\0\0\0\0" return mac2str(x) def m2i(self, pkt, x): return str2mac(x) @@ -301,7 +301,7 @@ class X3BytesField(XByteField): def addfield(self, pkt, s, val): return s+struct.pack(self.fmt, self.i2m(pkt,val))[1:4] def getfield(self, pkt, s): - return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0]) + return s[3:], self.m2i(pkt, struct.unpack(self.fmt, b"\x00"+s[:3])[0]) class ThreeBytesField(X3BytesField, ByteField): def i2repr(self, pkt, x): @@ -501,7 +501,7 @@ class StrFixedLenField(StrField): self.length_from = lambda pkt,length=length: length def i2repr(self, pkt, v): if type(v) is str: - v = v.rstrip("\0") + v = v.rstrip(b"\0") return repr(v) def getfield(self, pkt, s): l = self.length_from(pkt) @@ -522,7 +522,7 @@ class StrFixedLenEnumField(StrFixedLenField): StrFixedLenField.__init__(self, name, default, length=length, length_from=length_from) self.enum = enum def i2repr(self, pkt, v): - r = v.rstrip("\0") + r = v.rstrip(b"\0") rr = repr(r) if v in self.enum: rr = "%s (%s)" % (rr, self.enum[v]) @@ -543,7 +543,7 @@ class NetBIOSNameField(StrFixedLenField): x = " "+x return x def m2i(self, pkt, x): - x = x.strip("\x00").strip(" ") + x = x.strip(b"\x00").strip(" ") return "".join(map(lambda x,y: chr((((ord(x)-1)&0xf)<<4)+((ord(y)-1)&0xf)), x[::2],x[1::2])) class StrLenField(StrField): @@ -677,15 +677,15 @@ class FieldLenField(Field): class StrNullField(StrField): def addfield(self, pkt, s, val): - return s+self.i2m(pkt, val)+"\x00" + return s+self.i2m(pkt, val)+b"\x00" def getfield(self, pkt, s): - l = s.find("\x00") + l = s.find(b"\x00") if l < 0: #XXX \x00 not found return "",s return s[l+1:],self.m2i(pkt, s[:l]) def randval(self): - return RandTermString(RandNum(0,1200),"\x00") + return RandTermString(RandNum(0,1200),b"\x00") class StrStopField(StrField): __slots__ = ["stop", "additionnal"] @@ -1269,22 +1269,22 @@ class _IPPrefixFieldBase(Field): return "%s/%i" % (pfx,pfxlen) def i2m(self, pkt, x): - # ("fc00:1::1", 64) -> ("\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) + # ("fc00:1::1", 64) -> (b"\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) (pfx,pfxlen)= x s= self.aton(pfx); return (s[:self._numbytes(pfxlen)], pfxlen) def m2i(self, pkt, x): - # ("\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) -> ("fc00:1::1", 64) + # (b"\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) -> ("fc00:1::1", 64) (s,pfxlen)= x if len(s) < self.maxbytes: - s= s + ("\0" * (self.maxbytes - len(s))) + s= s + (b"\0" * (self.maxbytes - len(s))) return (self.ntoa(s), pfxlen) def any2i(self, pkt, x): if x is None: - return (self.ntoa("\0"*self.maxbytes), 1) + return (self.ntoa(b"\0"*self.maxbytes), 1) return self.h2i(pkt,x) diff --git a/scapy/layers/bluetooth.py b/scapy/layers/bluetooth.py index ab48fbb34f8c69bee738efe9b7a776a1399f5bff..5ee2fe76ece692c069d092a0e07808a626afc08c 100644 --- a/scapy/layers/bluetooth.py +++ b/scapy/layers/bluetooth.py @@ -40,7 +40,7 @@ class LEMACField(Field): Field.__init__(self, name, default, "6s") def i2m(self, pkt, x): if x is None: - return "\0\0\0\0\0\0" + return b"\0\0\0\0\0\0" return mac2str(x)[::-1] def m2i(self, pkt, x): return str2mac(x[::-1]) @@ -322,11 +322,11 @@ class SM_Pairing_Response(Packet): class SM_Confirm(Packet): name = "Pairing Confirm" - fields_desc = [ StrFixedLenField("confirm", '\x00' * 16, 16) ] + fields_desc = [ StrFixedLenField("confirm", b'\x00' * 16, 16) ] class SM_Random(Packet): name = "Pairing Random" - fields_desc = [ StrFixedLenField("random", '\x00' * 16, 16) ] + fields_desc = [ StrFixedLenField("random", b'\x00' * 16, 16) ] class SM_Failed(Packet): name = "Pairing Failed" @@ -334,16 +334,16 @@ class SM_Failed(Packet): class SM_Encryption_Information(Packet): name = "Encryption Information" - fields_desc = [ StrFixedLenField("ltk", "\x00" * 16, 16), ] + fields_desc = [ StrFixedLenField("ltk", b"\x00" * 16, 16), ] class SM_Master_Identification(Packet): name = "Master Identification" fields_desc = [ XLEShortField("ediv", 0), - StrFixedLenField("rand", '\x00' * 8, 8), ] + StrFixedLenField("rand", b'\x00' * 8, 8), ] class SM_Identity_Information(Packet): name = "Identity Information" - fields_desc = [ StrFixedLenField("irk", '\x00' * 16, 16), ] + fields_desc = [ StrFixedLenField("irk", b'\x00' * 16, 16), ] class SM_Identity_Address_Information(Packet): name = "Identity Address Information" @@ -352,7 +352,7 @@ class SM_Identity_Address_Information(Packet): class SM_Signing_Information(Packet): name = "Signing Information" - fields_desc = [ StrFixedLenField("csrk", '\x00' * 16, 16), ] + fields_desc = [ StrFixedLenField("csrk", b'\x00' * 16, 16), ] class EIR_Hdr(Packet): @@ -487,7 +487,7 @@ class HCI_Cmd_LE_Host_Supported(Packet): class HCI_Cmd_Set_Event_Mask(Packet): name = "Set Event Mask" - fields_desc = [ StrFixedLenField("mask", "\xff\xff\xfb\xff\x07\xf8\xbf\x3d", 8) ] + fields_desc = [ StrFixedLenField("mask", b"\xff\xff\xfb\xff\x07\xf8\xbf\x3d", 8) ] class HCI_Cmd_Read_BD_Addr(Packet): name = "Read BD Addr" @@ -571,7 +571,7 @@ class HCI_Cmd_LE_Start_Encryption_Request(Packet): fields_desc = [ LEShortField("handle", 0), StrFixedLenField("rand", None, 8), XLEShortField("ediv", 0), - StrFixedLenField("ltk", '\x00' * 16, 16), ] + StrFixedLenField("ltk", b'\x00' * 16, 16), ] class HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply(Packet): name = "LE Long Term Key Request Negative Reply" @@ -580,7 +580,7 @@ class HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply(Packet): class HCI_Cmd_LE_Long_Term_Key_Request_Reply(Packet): name = "LE Long Term Key Request Reply" fields_desc = [ LEShortField("handle", 0), - StrFixedLenField("ltk", '\x00' * 16, 16), ] + StrFixedLenField("ltk", b'\x00' * 16, 16), ] class HCI_Event_Hdr(Packet): name = "HCI Event header" diff --git a/scapy/layers/dhcp.py b/scapy/layers/dhcp.py index 139bb3203ea96d6bed18b8d3e2c936ff6b2a03d9..96094066867c80793e04bc946dfe7b0ea40f657e 100644 --- a/scapy/layers/dhcp.py +++ b/scapy/layers/dhcp.py @@ -23,7 +23,7 @@ from scapy.arch import get_if_raw_hwaddr from scapy.sendrecv import * from scapy.error import warning -dhcpmagic="c\x82Sc" +dhcpmagic=b"c\x82Sc" class BOOTP(Packet): @@ -269,7 +269,7 @@ class DHCPOptionsField(StrField): DHCPRevOptions[o][1] == None): s += chr(DHCPRevOptions[o][0]) elif type(o) is int: - s += chr(o)+"\0" + s += chr(o)+b"\0" elif type(o) is str: s += o else: @@ -285,7 +285,7 @@ class DHCP(Packet): bind_layers( UDP, BOOTP, dport=67, sport=68) bind_layers( UDP, BOOTP, dport=68, sport=67) bind_bottom_up( UDP, BOOTP, dport=67, sport=67) -bind_layers( BOOTP, DHCP, options='c\x82Sc') +bind_layers( BOOTP, DHCP, options=b'c\x82Sc') @conf.commands.register def dhcp_request(iface=None,**kargs): diff --git a/scapy/layers/dns.py b/scapy/layers/dns.py index d29da49b99f8a0695cf843f2e7d81f95c01dc730..8e2f5cae5b8155c41c2db3cc3886958c55317f97 100644 --- a/scapy/layers/dns.py +++ b/scapy/layers/dns.py @@ -27,13 +27,13 @@ class DNSStrField(StrField): def i2m(self, pkt, x): if x == ".": - return "\x00" + return b"\x00" x = [k[:63] for k in x.split(".")] # Truncate chunks that cannot be encoded (more than 63 bytes..) x = map(lambda y: chr(len(y))+y, x) x = "".join(x) - if x[-1] != "\x00": - x += "\x00" + if x[-1] != b"\x00": + x += b"\x00" return x def getfield(self, pkt, s): @@ -125,12 +125,12 @@ class DNSRRField(StrField): ret = s[p:p+10] type,cls,ttl,rdlen = struct.unpack("!HHIH", ret) p += 10 - rr = DNSRR("\x00"+ret+s[p:p+rdlen]) + rr = DNSRR(b"\x00"+ret+s[p:p+rdlen]) if type in [2, 3, 4, 5]: rr.rdata = DNSgetstr(s,p)[0] del(rr.rdlen) elif type in DNSRR_DISPATCHER: - rr = DNSRR_DISPATCHER[type]("\x00"+ret+s[p:p+rdlen]) + rr = DNSRR_DISPATCHER[type](b"\x00"+ret+s[p:p+rdlen]) else: del(rr.rdlen) @@ -166,7 +166,7 @@ class DNSQRField(DNSRRField): def decodeRR(self, name, s, p): ret = s[p:p+4] p += 4 - rr = DNSQR("\x00"+ret) + rr = DNSQR(b"\x00"+ret) rr.qname = name return rr,p @@ -203,14 +203,14 @@ class RDataField(StrLenField): elif pkt.type in [2, 3, 4, 5, 12]: # NS, MD, MF, CNAME, PTR s = "".join(map(lambda x: chr(len(x))+x, s.split("."))) if ord(s[-1]): - s += "\x00" + s += b"\x00" elif pkt.type == 16: # TXT if s: ret_s = "" # The initial string must be splitted into a list of strings # prepended with theirs sizes. while len(s) >= 255: - ret_s += "\xff" + s[:255] + ret_s += b"\xff" + s[:255] s = s[255:] # The remaining string is less than 255 bytes long if len(s): diff --git a/scapy/layers/dot11.py b/scapy/layers/dot11.py index 18a4bc4a1d094167fa24d7a84d7e273800905215..1bdbe33ebb3ce60ec86839ce8605b559f2f13aff 100644 --- a/scapy/layers/dot11.py +++ b/scapy/layers/dot11.py @@ -177,7 +177,7 @@ class Dot11(Packet): def guess_payload_class(self, payload): if self.type == 0x02 and (0x08 <= self.subtype <= 0xF and self.subtype != 0xD): return Dot11QoS - elif self.FCfield & 0x40: + elif self.FCfield & 0x40: return Dot11WEP else: return Packet.guess_payload_class(self, payload) @@ -318,7 +318,7 @@ class Dot11Deauth(Packet): class Dot11WEP(Packet): name = "802.11 WEP packet" - fields_desc = [ StrFixedLenField("iv", "\0\0\0", 3), + fields_desc = [ StrFixedLenField("iv", b"\0\0\0", 3), ByteField("keyid", 0), StrField("wepdata",None,remain=4), IntField("icv",None) ] diff --git a/scapy/layers/gprs.py b/scapy/layers/gprs.py index 31a931fe82c3bd7479f79f546c81f7d87a1f1a8b..9b0ec4c698232e1713b1e80780b92b1658c4e5fc 100644 --- a/scapy/layers/gprs.py +++ b/scapy/layers/gprs.py @@ -14,7 +14,7 @@ from scapy.layers.inet import IP class GPRS(Packet): name = "GPRSdummy" fields_desc = [ - StrStopField("dummy","","\x65\x00\x00",1) + StrStopField("dummy","",b"\x65\x00\x00",1) ] diff --git a/scapy/layers/hsrp.py b/scapy/layers/hsrp.py index 9fa09c1db3aa32e196a59f706af6e6593537278e..f7a042f9eb3319d65fd8c801c8f8efb952978dbb 100644 --- a/scapy/layers/hsrp.py +++ b/scapy/layers/hsrp.py @@ -49,7 +49,7 @@ class HSRP(Packet): ByteField("priority", 120), ByteField("group", 1), ByteField("reserved", 0), - StrFixedLenField("auth", "cisco" + "\00" * 3, 8), + StrFixedLenField("auth", "cisco" + b"\00" * 3, 8), IPField("virtualIP", "192.168.1.1")] def guess_payload_class(self, payload): @@ -69,7 +69,7 @@ class HSRPmd5(Packet): XShortField("flags", 0x00), SourceIPField("sourceip", None), XIntField("keyid", 0x00), - StrFixedLenField("authdigest", "\00" * 16, 16)] + StrFixedLenField("authdigest", b"\00" * 16, 16)] def post_build(self, p, pay): if self.len is None and pay: diff --git a/scapy/layers/inet.py b/scapy/layers/inet.py index f20bf1d273a883b455334b3e7863f34b05142224..31fc420f4b93f36bf9956dfa7ffcb56a063771c7 100644 --- a/scapy/layers/inet.py +++ b/scapy/layers/inet.py @@ -285,10 +285,10 @@ class TCPOptionsField(StrField): for oname,oval in x: if type(oname) is str: if oname == "NOP": - opt += "\x01" + opt += b"\x01" continue elif oname == "EOL": - opt += "\x00" + opt += b"\x00" continue elif TCPOptions[1].has_key(oname): onum = TCPOptions[1][oname] @@ -308,7 +308,7 @@ class TCPOptionsField(StrField): warning("option [%i] is not string."%onum) continue opt += chr(onum)+chr(2+len(oval))+oval - return opt+"\x00"*(3-((len(opt)+3)%4)) + return opt+b"\x00"*(3-((len(opt)+3)%4)) def randval(self): return [] # XXX @@ -371,7 +371,7 @@ class IP(Packet, IPTools): PacketListField("options", [], IPOption, length_from=lambda p:p.ihl*4-20) ] def post_build(self, p, pay): ihl = self.ihl - p += "\0"*((-len(p))%4) # pad IP options if needed + p += b"\0"*((-len(p))%4) # pad IP options if needed if ihl is None: ihl = len(p)/4 p = chr(((self.version&0xf)<<4) | ihl&0x0f)+p[1:] @@ -1406,7 +1406,7 @@ class TracerouteResult(SndRcvList): for snd,rcv in self.res: if rcv.src not in ports and rcv.haslayer(conf.padding_layer): p = rcv.getlayer(conf.padding_layer).load - if p != "\x00"*len(p): + if p != b"\x00"*len(p): pad[rcv.src]=None for rcv in pad: s += '\t"%s" [shape=triangle,color=black,fillcolor=red,style=filled];\n' % rcv @@ -1652,8 +1652,8 @@ funcpres: a function used to summarize packets""" def fragleak(target,sport=123, dport=123, timeout=0.2, onlyasc=0): load = "XXXXYYYYYYYYYY" # getmacbyip(target) -# pkt = IP(dst=target, id=RandShort(), options="\x22"*40)/UDP()/load - pkt = IP(dst=target, id=RandShort(), options="\x00"*40, flags=1)/UDP(sport=sport, dport=sport)/load +# pkt = IP(dst=target, id=RandShort(), options=b"\x22"*40)/UDP()/load + pkt = IP(dst=target, id=RandShort(), options=b"\x00"*40, flags=1)/UDP(sport=sport, dport=sport)/load s=conf.L3socket() intr=0 found={} @@ -1705,7 +1705,7 @@ def fragleak2(target, timeout=0.4, onlyasc=0): found={} try: while 1: - p = sr1(IP(dst=target, options="\x00"*40, proto=200)/"XXXXYYYYYYYYYYYY",timeout=timeout,verbose=0) + p = sr1(IP(dst=target, options=b"\x00"*40, proto=200)/"XXXXYYYYYYYYYYYY",timeout=timeout,verbose=0) if not p: continue if conf.padding_layer in p: diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py index c6d8a5370c13c9a3815d83b4ea7c67f98cd09e60..c605825757db17b72ad6506ff13db40c964908bc 100644 --- a/scapy/layers/inet6.py +++ b/scapy/layers/inet6.py @@ -868,7 +868,7 @@ class _HopByHopOptionsField(PacketListField): if d == 1: s += str(Pad1()) elif d != 0: - s += str(PadN(optdata='\x00'*(d-2))) + s += str(PadN(optdata=b'\x00'*(d-2))) pstr = str(p) curpos += len(pstr) s += pstr @@ -882,7 +882,7 @@ class _HopByHopOptionsField(PacketListField): if d == 1: s += str(Pad1()) elif d != 0: - s += str(PadN(optdata='\x00'*(d-2))) + s += str(PadN(optdata=b'\x00'*(d-2))) return s @@ -997,7 +997,7 @@ class IPv6ExtHdrSegmentRoutingTLVPadding(IPv6ExtHdrSegmentRoutingTLV): name = "IPv6 Option Header Segment Routing - Padding TLV" fields_desc = [ ByteField("type", 4), FieldLenField("len", None, length_of="padding", fmt="B"), - StrLenField("padding", "\x00", length_from=lambda pkt: pkt.len) ] + StrLenField("padding", b"\x00", length_from=lambda pkt: pkt.len) ] class IPv6ExtHdrSegmentRouting(_IPv6ExtHdr): @@ -1031,7 +1031,7 @@ class IPv6ExtHdrSegmentRouting(_IPv6ExtHdr): warning("IPv6ExtHdrSegmentRouting(): can't pad 1 byte !") elif tmp_mod >= 2: #Add the padding extension - tmp_pad = "\x00" * (tmp_mod-2) + tmp_pad = b"\x00" * (tmp_mod-2) tlv = IPv6ExtHdrSegmentRoutingTLVPadding(padding=tmp_pad) pkt += str(tlv) @@ -1702,7 +1702,7 @@ class ICMPv6NDOptRedirectedHdr(_ICMPv6NDGuessPayload, Packet): fields_desc = [ ByteField("type",4), FieldLenField("len", None, length_of="pkt", fmt="B", adjust = lambda pkt,x:(x+8)/8), - StrFixedLenField("res", "\x00"*6, 6), + StrFixedLenField("res", b"\x00"*6, 6), TruncPktLenField("pkt", "", IPv6, 8, length_from = lambda pkt: 8*pkt.len-8) ] @@ -1806,7 +1806,7 @@ class _IP6PrefixField(IP6Field): l = self.length_from(pkt) p = s[:l] if l < 16: - p += '\x00'*(16-l) + p += b'\x00'*(16-l) return s[l:], self.m2i(pkt,p) def i2len(self, pkt, x): @@ -1828,7 +1828,7 @@ class _IP6PrefixField(IP6Field): if l in [2, 3]: return x[:8*(l-1)] - return x + '\x00'*8*(l-3) + return x + b'\x00'*8*(l-3) class ICMPv6NDOptRouteInfo(_ICMPv6NDGuessPayload, Packet): # RFC 4191 name = "ICMPv6 Neighbor Discovery Option - Route Information Option" @@ -1879,7 +1879,7 @@ class DomainNameListField(StrLenField): while x: # Get a name until \x00 is reached cur = [] - while x and x[0] != '\x00': + while x and x[0] != b'\x00': l = ord(x[0]) cur.append(x[1:l+1]) x = x[l+1:] @@ -1890,22 +1890,22 @@ class DomainNameListField(StrLenField): else: # Store the current name res.append(".".join(cur) + ".") - if x and x[0] == '\x00': + if x and x[0] == b'\x00': x = x[1:] return res def i2m(self, pkt, x): def conditionalTrailingDot(z): - if z and z[-1] == '\x00': + if z and z[-1] == b'\x00': return z - return z+'\x00' + return z+b'\x00' # Build the encode names tmp = map(lambda y: map((lambda z: chr(len(z))+z), y.split('.')), x) ret_string = "".join(map(lambda x: conditionalTrailingDot("".join(x)), tmp)) # In padded mode, add some \x00 bytes if self.padded and not len(ret_string) % self.padded_unit == 0: - ret_string += "\x00" * (self.padded_unit - len(ret_string) % self.padded_unit) + ret_string += b"\x00" * (self.padded_unit - len(ret_string) % self.padded_unit) return ret_string @@ -2010,7 +2010,7 @@ class ICMPv6NDOptSrcAddrList(_ICMPv6NDGuessPayload, Packet): fields_desc = [ ByteField("type",9), FieldLenField("len", None, count_of="addrlist", fmt="B", adjust = lambda pkt,x: 2*x+1), - StrFixedLenField("res", "\x00"*6, 6), + StrFixedLenField("res", b"\x00"*6, 6), IP6ListField("addrlist", [], length_from = lambda pkt: 8*(pkt.len-1)) ] @@ -2135,15 +2135,15 @@ def names2dnsrepr(x): """ if type(x) is str: - if x and x[-1] == '\x00': # stupid heuristic + if x and x[-1] == b'\x00': # stupid heuristic return x x = [x] res = [] for n in x: - termin = "\x00" + termin = b"\x00" if n.count('.') == 0: # single-component gets one more - termin += '\x00' + termin += b'\x00' n = "".join(map(lambda y: chr(len(y))+y, n.split("."))) + termin res.append(n) return "".join(res) @@ -2740,7 +2740,7 @@ class MIP6OptCareOfTest(_MIP6OptAlign, Packet): # RFC 4866 (Sect. 5.5) name = "MIPv6 option - Care-of Test" fields_desc = [ ByteEnumField("otype", 16, _mobopttypes), FieldLenField("olen", None, length_of="cokt", fmt="B"), - StrLenField("cokt", '\x00'*8, + StrLenField("cokt", b'\x00'*8, length_from = lambda pkt: pkt.olen) ] x = 0 ; y = 0 # alignment requirement: none @@ -2838,7 +2838,7 @@ class MIP6MH_Generic(_MobilityHeader): # Mainly for decoding of unknown msg ByteEnumField("mhtype", None, mhtypes), ByteField("res", None), XShortField("cksum", None), - StrLenField("msg", "\x00"*2, + StrLenField("msg", b"\x00"*2, length_from = lambda pkt: 8*pkt.len-6) ] @@ -2894,7 +2894,7 @@ class _MobilityOptionsField(PacketListField): if d == 1: s += str(Pad1()) elif d != 0: - s += str(PadN(optdata='\x00'*(d-2))) + s += str(PadN(optdata=b'\x00'*(d-2))) pstr = str(p) curpos += len(pstr) s += pstr @@ -2908,7 +2908,7 @@ class _MobilityOptionsField(PacketListField): if d == 1: s += str(Pad1()) elif d != 0: - s += str(PadN(optdata='\x00'*(d-2))) + s += str(PadN(optdata=b'\x00'*(d-2))) return s @@ -2929,9 +2929,9 @@ class MIP6MH_BRR(_MobilityHeader): overload_fields = { IPv6: { "nh": 135 } } def hashret(self): # Hack: BRR, BU and BA have the same hashret that returns the same - # value "\x00\x08\x09" (concatenation of mhtypes). This is + # value b"\x00\x08\x09" (concatenation of mhtypes). This is # because we need match BA with BU and BU with BRR. --arno - return "\x00\x08\x09" + return b"\x00\x08\x09" class MIP6MH_HoTI(_MobilityHeader): name = "IPv6 Mobility Header - Home Test Init" @@ -2940,8 +2940,8 @@ class MIP6MH_HoTI(_MobilityHeader): ByteEnumField("mhtype", 1, mhtypes), ByteField("res", None), XShortField("cksum", None), - StrFixedLenField("reserved", "\x00"*2, 2), - StrFixedLenField("cookie", "\x00"*8, 8), + StrFixedLenField("reserved", b"\x00"*2, 2), + StrFixedLenField("cookie", b"\x00"*8, 8), _PhantomAutoPadField("autopad", 1), # autopad activated by default _MobilityOptionsField("options", [], MIP6OptUnknown, 16, length_from = lambda pkt: 8*(pkt.len-1)) ] @@ -2963,8 +2963,8 @@ class MIP6MH_HoT(_MobilityHeader): ByteField("res", None), XShortField("cksum", None), ShortField("index", None), - StrFixedLenField("cookie", "\x00"*8, 8), - StrFixedLenField("token", "\x00"*8, 8), + StrFixedLenField("cookie", b"\x00"*8, 8), + StrFixedLenField("token", b"\x00"*8, 8), _PhantomAutoPadField("autopad", 1), # autopad activated by default _MobilityOptionsField("options", [], MIP6OptUnknown, 24, length_from = lambda pkt: 8*(pkt.len-2)) ] @@ -3010,7 +3010,7 @@ class MIP6MH_BU(_MobilityHeader): overload_fields = { IPv6: { "nh": 135 } } def hashret(self): # Hack: see comment in MIP6MH_BRR.hashret() - return "\x00\x08\x09" + return b"\x00\x08\x09" def answers(self, other): if isinstance(other, MIP6MH_BRR): @@ -3035,7 +3035,7 @@ class MIP6MH_BA(_MobilityHeader): overload_fields = { IPv6: { "nh": 135 }} def hashret(self): # Hack: see comment in MIP6MH_BRR.hashret() - return "\x00\x08\x09" + return b"\x00\x08\x09" def answers(self, other): if (isinstance(other, MIP6MH_BU) and diff --git a/scapy/layers/ipsec.py b/scapy/layers/ipsec.py index 9153ac7c4494af93fabf0b313270241afe75a137..fee198c35405a0274645b4c25c4bb552f5ae4f88 100644 --- a/scapy/layers/ipsec.py +++ b/scapy/layers/ipsec.py @@ -29,7 +29,7 @@ Example of use: >>> >>> e = sa.encrypt(p) >>> e -<IP version=4L ihl=5L tos=0x0 len=76 id=1 flags= frag=0L ttl=64 proto=esp chksum=0x747a src=1.1.1.1 dst=2.2.2.2 |<ESP spi=0xdeadbeef seq=1 data='\xf8\xdb\x1e\x83[T\xab\\\xd2\x1b\xed\xd1\xe5\xc8Y\xc2\xa5d\x92\xc1\x05\x17\xa6\x92\x831\xe6\xc1]\x9a\xd6K}W\x8bFfd\xa5B*+\xde\xc8\x89\xbf{\xa9' |>> +<IP version=4L ihl=5L tos=0x0 len=76 id=1 flags= frag=0L ttl=64 proto=esp chksum=0x747a src=1.1.1.1 dst=2.2.2.2 |<ESP spi=0xdeadbeef seq=1 data=b'\xf8\xdb\x1e\x83[T\xab\\\xd2\x1b\xed\xd1\xe5\xc8Y\xc2\xa5d\x92\xc1\x05\x17\xa6\x92\x831\xe6\xc1]\x9a\xd6K}W\x8bFfd\xa5B*+\xde\xc8\x89\xbf{\xa9' |>> >>> >>> d = sa.decrypt(e) >>> d diff --git a/scapy/layers/l2.py b/scapy/layers/l2.py index ca87d469c4122411b6b299682c92038eecf3adc7..584deda13fd839960ebc217b2d13c2ae9095234f 100644 --- a/scapy/layers/l2.py +++ b/scapy/layers/l2.py @@ -654,7 +654,7 @@ class MKABasicParamSet(Packet): length_from=lambda pkt: (pkt.param_set_body_len - 28) ), 4, - padwith="\x00" + padwith=b"\x00" ) ] @@ -695,7 +695,7 @@ class MKALivePeerListParamSet(MKAParamSet): _parameter_set_types ), 2, - padwith="\x00" + padwith=b"\x00" ), ShortField("param_set_body_len", 0), PacketListField("member_id_message_num", [], MKAPeerListTuple) @@ -723,7 +723,7 @@ class MKAPotentialPeerListParamSet(MKAParamSet): _parameter_set_types ), 2, - padwith="\x00" + padwith=b"\x00" ), ShortField("param_set_body_len", 0), PacketListField("member_id_message_num", [], MKAPeerListTuple) @@ -818,7 +818,7 @@ class MKADistributedCAKParamSet(MKAParamSet): _parameter_set_types ), 2, - padwith="\x00" + padwith=b"\x00" ), ShortField("param_set_body_len", 0), XStrFixedLenField( @@ -851,7 +851,7 @@ class MKAICVSet(MKAParamSet): _parameter_set_types ), 2, - padwith="\x00" + padwith=b"\x00" ), ShortField("param_set_body_len", 0), XStrFixedLenField("icv", "", length=MKAParamSet.MACSEC_DEFAULT_ICV_LEN) diff --git a/scapy/layers/lltd.py b/scapy/layers/lltd.py index 9a592edb43ada2c178597837c09bb90495c77945..e70da86e61facd3029f5312de60235bad315c24b 100644 --- a/scapy/layers/lltd.py +++ b/scapy/layers/lltd.py @@ -722,7 +722,7 @@ class LLTDAttributeDeviceUUID(LLTDAttribute): name = "LLTD Attribute - Device UUID" fields_desc = [ FieldLenField("len", None, length_of="uuid", fmt="B"), - StrLenField("uuid", "\x00" * 16, length_from=lambda pkt: pkt.len), + StrLenField("uuid", b"\x00" * 16, length_from=lambda pkt: pkt.len), ] @@ -827,7 +827,7 @@ class LargeTlvBuilder(object): data = self.data.setdefault(key, array("B")) datalen = len(data) if datalen < loc.stop: - data.extend(array("B", "\x00" * (loc.stop - datalen))) + data.extend(array("B", b"\x00" * (loc.stop - datalen))) data[loc] = array("B", pkt[LLTDQueryLargeTlvResp].value) def get_data(self): diff --git a/scapy/layers/mgcp.py b/scapy/layers/mgcp.py index 5d8a064ec3500d7a5a3ad57db4a65778ebdb2141..2e4b5e077e543f840ab23d94d68bf0c4f2b6a76a 100644 --- a/scapy/layers/mgcp.py +++ b/scapy/layers/mgcp.py @@ -22,8 +22,8 @@ class MGCP(Packet): StrFixedLenField("sep2"," ",1), StrStopField("endpoint","dummy@dummy.net"," ", -1), StrFixedLenField("sep3"," ",1), - StrStopField("version","MGCP 1.0 NCS 1.0","\x0a", -1), - StrFixedLenField("sep4","\x0a",1), + StrStopField("version","MGCP 1.0 NCS 1.0",b"\x0a", -1), + StrFixedLenField("sep4",b"\x0a",1), ] diff --git a/scapy/layers/ntp.py b/scapy/layers/ntp.py index 15c69629517c4507390c8cc073cac2e5bb821d98..dd8520122b26cd6ce6eba0019caf23c2ce5097aa 100644 --- a/scapy/layers/ntp.py +++ b/scapy/layers/ntp.py @@ -349,7 +349,7 @@ class NTPExtension(Packet): fields_desc = [ ShortField("type", 0), ShortField("len", 0), - PadField(PacketField("value", "", Packet), align=4, padwith="\x00") + PadField(PacketField("value", "", Packet), align=4, padwith=b"\x00") ] @@ -1367,9 +1367,9 @@ class NTPInfoIfStatsIPv4(Packet): name = "info_if_stats" fields_desc = [ - PadField(IPField("unaddr", "0.0.0.0"), 16, padwith="\x00"), - PadField(IPField("unbcast", "0.0.0.0"), 16, padwith="\x00"), - PadField(IPField("unmask", "0.0.0.0"), 16, padwith="\x00"), + PadField(IPField("unaddr", "0.0.0.0"), 16, padwith=b"\x00"), + PadField(IPField("unbcast", "0.0.0.0"), 16, padwith=b"\x00"), + PadField(IPField("unmask", "0.0.0.0"), 16, padwith=b"\x00"), IntField("v6_flag", 0), StrFixedLenField("ifname", "", length=32), IntField("flags", 0), @@ -1730,18 +1730,18 @@ class NTPPrivate(NTP): # monitoring, statistics gathering and configuration. A mode 7 # packet has the following format: # - # 0 1 2 3 + # 0 1 2 3 # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # |R|M| VN | Mode|A| Sequence | Implementation| Req Code | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # | Err | Number of data items | MBZ | Size of data item | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | | + # | | # | Data (Minimum 0 octets, maximum 500 octets) | # | | # [...] | - # | | + # | | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # | Encryption Keyid (when A bit set) | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -1755,59 +1755,59 @@ class NTPPrivate(NTP): # # Response Bit: This packet is a response (if clear, packet is a request). # - # More Bit: Set for all packets but the last in a response which - # requires more than one packet. + # More Bit: Set for all packets but the last in a response which + # requires more than one packet. # # Version Number: 2 for current version # - # Mode: Always 7 + # Mode: Always 7 # # Authenticated bit: If set, this packet is authenticated. # # Sequence number: For a multipacket response, contains the sequence - # number of this packet. 0 is the first in the sequence, - # 127 (or less) is the last. The More Bit must be set in - # all packets but the last. + # number of this packet. 0 is the first in the sequence, + # 127 (or less) is the last. The More Bit must be set in + # all packets but the last. # # Implementation number: The number of the implementation this request code - # is defined by. An implementation number of zero is used - # for request codes/data formats which all implementations - # agree on. Implementation number 255 is reserved (for - # extensions, in case we run out). + # is defined by. An implementation number of zero is used + # for request codes/data formats which all implementations + # agree on. Implementation number 255 is reserved (for + # extensions, in case we run out). # # Request code: An implementation-specific code which specifies the - # operation to be (which has been) performed and/or the - # format and semantics of the data included in the packet. + # operation to be (which has been) performed and/or the + # format and semantics of the data included in the packet. # - # Err: Must be 0 for a request. For a response, holds an error - # code relating to the request. If nonzero, the operation - # requested wasn"t performed. + # Err: Must be 0 for a request. For a response, holds an error + # code relating to the request. If nonzero, the operation + # requested wasn"t performed. # - # 0 - no error - # 1 - incompatible implementation number - # 2 - unimplemented request code - # 3 - format error (wrong data items, data size, packet size etc.) - # 4 - no data available (e.g. request for details on unknown peer) - # 5-6 I don"t know - # 7 - authentication failure (i.e. permission denied) + # 0 - no error + # 1 - incompatible implementation number + # 2 - unimplemented request code + # 3 - format error (wrong data items, data size, packet size etc.) + # 4 - no data available (e.g. request for details on unknown peer) + # 5-6 I don"t know + # 7 - authentication failure (i.e. permission denied) # # Number of data items: number of data items in packet. 0 to 500 # - # MBZ: A reserved data field, must be zero in requests and responses. + # MBZ: A reserved data field, must be zero in requests and responses. # # Size of data item: size of each data item in packet. 0 to 500 # - # Data: Variable sized area containing request/response data. For - # requests and responses the size in octets must be greater - # than or equal to the product of the number of data items - # and the size of a data item. For requests the data area - # must be exactly 40 octets in length. For responses the - # data area may be any length between 0 and 500 octets - # inclusive. + # Data: Variable sized area containing request/response data. For + # requests and responses the size in octets must be greater + # than or equal to the product of the number of data items + # and the size of a data item. For requests the data area + # must be exactly 40 octets in length. For responses the + # data area may be any length between 0 and 500 octets + # inclusive. # # Message Authentication Code: Same as NTP spec, in definition and function. - # May optionally be included in requests which require - # authentication, is never included in responses. + # May optionally be included in requests which require + # authentication, is never included in responses. # # The version number, mode and keyid have the same function and are # in the same location as a standard NTP packet. The request packet diff --git a/scapy/layers/pflog.py b/scapy/layers/pflog.py index a8fc9fe057affe04d2c8b65a1e3d65a31be35389..ead22510e582c13fb65f1ac633ea54fac172c484 100644 --- a/scapy/layers/pflog.py +++ b/scapy/layers/pflog.py @@ -48,7 +48,7 @@ class PFLog(Packet): IntField("rulepid", 0), ByteEnumField("direction", 255, {0: "inout", 1: "in", 2:"out", 255: "unknown"}), - StrFixedLenField("pad", "\x00\x00\x00", 3 ) ] + StrFixedLenField("pad", b"\x00\x00\x00", 3 ) ] def mysummary(self): return self.sprintf("%PFLog.addrfamily% %PFLog.action% on %PFLog.iface% by rule %PFLog.rulenumber%") diff --git a/scapy/layers/ppp.py b/scapy/layers/ppp.py index e415eebfee4f348f067c91c28d47abef0dfbb559..191e8373f71a336847f66094aefd83ec4a00d5e8 100644 --- a/scapy/layers/ppp.py +++ b/scapy/layers/ppp.py @@ -204,7 +204,7 @@ class PPP(Packet): fields_desc = [ ShortEnumField("proto", 0x0021, _PPP_proto) ] @classmethod def dispatch_hook(cls, _pkt=None, *args, **kargs): - if _pkt and _pkt[0] == '\xff': + if _pkt and _pkt[0] == b'\xff': cls = HDLC return cls @@ -295,7 +295,7 @@ class PPP_IPCP_Option_NBNS2(PPP_IPCP_Option): class PPP_IPCP(Packet): fields_desc = [ ByteEnumField("code" , 1, _PPP_conftypes), - XByteField("id", 0 ), + XByteField("id", 0 ), FieldLenField("len" , None, fmt="H", length_of="options", adjust=lambda p,x:x+4 ), PacketListField("options", [], PPP_IPCP_Option, length_from=lambda p:p.len-4,) ] @@ -335,7 +335,7 @@ class PPP_ECP_Option_OUI(PPP_ECP_Option): class PPP_ECP(Packet): fields_desc = [ ByteEnumField("code" , 1, _PPP_conftypes), - XByteField("id", 0 ), + XByteField("id", 0 ), FieldLenField("len" , None, fmt="H", length_of="options", adjust=lambda p,x:x+4 ), PacketListField("options", [], PPP_ECP_Option, length_from=lambda p:p.len-4,) ] diff --git a/scapy/layers/rip.py b/scapy/layers/rip.py index 1507fe5c1422294b9aa8655d0ec84577c3d84200..643dde20f0426cc55db5261b68047fa67475251b 100644 --- a/scapy/layers/rip.py +++ b/scapy/layers/rip.py @@ -22,7 +22,7 @@ class RIP(Packet): ] def guess_payload_class(self, payload): - if payload[:2] == "\xff\xff": + if payload[:2] == b"\xff\xff": return RIPAuth else: return Packet.guess_payload_class(self, payload) @@ -61,7 +61,7 @@ class RIPAuth(Packet): ] def pre_dissect(self, s): - if s[2:4] == "\x00\x01": + if s[2:4] == b"\x00\x01": self.md5datalen = len(s) - 4 return s diff --git a/scapy/layers/sctp.py b/scapy/layers/sctp.py index ff0b0946efe0bf8355be7d5b7af04807b3d7b8bc..886321f9015b65268da20a101f5c0e2ae99d28c7 100644 --- a/scapy/layers/sctp.py +++ b/scapy/layers/sctp.py @@ -229,7 +229,7 @@ class SCTPChunkParamHearbeatInfo(_SCTPChunkParam, Packet): adjust = lambda pkt,x:x+4), PadField(StrLenField("data", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"),] + 4, padwith=b"\x00"),] class SCTPChunkParamIPv4Addr(_SCTPChunkParam, Packet): fields_desc = [ ShortEnumField("type", 5, sctpchunkparamtypes), @@ -247,7 +247,7 @@ class SCTPChunkParamStateCookie(_SCTPChunkParam, Packet): adjust = lambda pkt,x:x+4), PadField(StrLenField("cookie", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"),] + 4, padwith=b"\x00"),] class SCTPChunkParamUnrocognizedParam(_SCTPChunkParam, Packet): fields_desc = [ ShortEnumField("type", 8, sctpchunkparamtypes), @@ -255,7 +255,7 @@ class SCTPChunkParamUnrocognizedParam(_SCTPChunkParam, Packet): adjust = lambda pkt,x:x+4), PadField(StrLenField("param", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"),] + 4, padwith=b"\x00"),] class SCTPChunkParamCookiePreservative(_SCTPChunkParam, Packet): fields_desc = [ ShortEnumField("type", 9, sctpchunkparamtypes), @@ -268,7 +268,7 @@ class SCTPChunkParamHostname(_SCTPChunkParam, Packet): adjust = lambda pkt,x:x+4), PadField(StrLenField("hostname", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"), ] + 4, padwith=b"\x00"), ] class SCTPChunkParamSupportedAddrTypes(_SCTPChunkParam, Packet): fields_desc = [ ShortEnumField("type", 12, sctpchunkparamtypes), @@ -277,7 +277,7 @@ class SCTPChunkParamSupportedAddrTypes(_SCTPChunkParam, Packet): PadField(FieldListField("addr_type_list", [ "IPv4" ], ShortEnumField("addr_type", 5, sctpchunkparamtypes), length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"), ] + 4, padwith=b"\x00"), ] class SCTPChunkParamECNCapable(_SCTPChunkParam, Packet): fields_desc = [ ShortEnumField("type", 32768, sctpchunkparamtypes), @@ -307,7 +307,7 @@ class SCTPChunkData(_SCTPChunkGuessPayload, Packet): XShortField("stream_seq", None), XIntField("proto_id", None), PadField(StrLenField("data", None, length_from=lambda pkt: pkt.len-16), - 4, padwith="\x00"), + 4, padwith=b"\x00"), ] class SCTPChunkInit(_SCTPChunkGuessPayload, Packet): @@ -339,7 +339,7 @@ class GapAckField(Field): Field.__init__(self, name, default, "4s") def i2m(self, pkt, x): if x is None: - return "\0\0\0\0" + return b"\0\0\0\0" sta, end = map(int, x.split(":")) args = tuple([">HH", sta, end]) return struct.pack(*args) @@ -388,7 +388,7 @@ class SCTPChunkAbort(_SCTPChunkGuessPayload, Packet): BitField("TCB", 0, 1), FieldLenField("len", None, length_of="error_causes", adjust = lambda pkt,x:x+4), PadField(StrLenField("error_causes", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"), + 4, padwith=b"\x00"), ] class SCTPChunkShutdown(_SCTPChunkGuessPayload, Packet): @@ -409,7 +409,7 @@ class SCTPChunkError(_SCTPChunkGuessPayload, Packet): XByteField("flags", None), FieldLenField("len", None, length_of="error_causes", adjust = lambda pkt,x:x+4), PadField(StrLenField("error_causes", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"), + 4, padwith=b"\x00"), ] class SCTPChunkCookieEcho(_SCTPChunkGuessPayload, Packet): @@ -417,7 +417,7 @@ class SCTPChunkCookieEcho(_SCTPChunkGuessPayload, Packet): XByteField("flags", None), FieldLenField("len", None, length_of="cookie", adjust = lambda pkt,x:x+4), PadField(StrLenField("cookie", "", length_from=lambda pkt: pkt.len-4), - 4, padwith="\x00"), + 4, padwith=b"\x00"), ] class SCTPChunkCookieAck(_SCTPChunkGuessPayload, Packet): diff --git a/scapy/layers/smb.py b/scapy/layers/smb.py index 73ebe5b15160cfb36d69145bf27c1af36d0a8eb9..271e500ce1e6948ba96f0181e262c36e5205be4b 100644 --- a/scapy/layers/smb.py +++ b/scapy/layers/smb.py @@ -15,7 +15,7 @@ from scapy.layers.netbios import NBTSession # SMB NetLogon Response Header class SMBNetlogon_Protocol_Response_Header(Packet): name="SMBNetlogon Protocol Response Header" - fields_desc = [StrFixedLenField("Start","\xffSMB",4), + fields_desc = [StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x25,{0x25:"Trans"}), ByteField("Error_Class",0x02), ByteField("Reserved",0), @@ -113,7 +113,7 @@ class SMBNetlogon_Protocol_Response_Tail_LM20(Packet): # SMBNegociate Protocol Request Header class SMBNegociate_Protocol_Request_Header(Packet): name="SMBNegociate Protocol Request Header" - fields_desc = [StrFixedLenField("Start","\xffSMB",4), + fields_desc = [StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}), ByteField("Error_Class",0), ByteField("Reserved",0), @@ -139,7 +139,7 @@ class SMBNegociate_Protocol_Request_Tail(Packet): # SMBNegociate Protocol Response Advanced Security class SMBNegociate_Protocol_Response_Advanced_Security(Packet): name="SMBNegociate Protocol Response Advanced Security" - fields_desc = [StrFixedLenField("Start","\xffSMB",4), + fields_desc = [StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}), ByteField("Error_Class",0), ByteField("Reserved",0), @@ -180,7 +180,7 @@ class SMBNegociate_Protocol_Response_Advanced_Security(Packet): # When using no security, with EncryptionKeyLength=8, you must have an EncryptionKey before the DomainName class SMBNegociate_Protocol_Response_No_Security(Packet): name="SMBNegociate Protocol Response No Security" - fields_desc = [StrFixedLenField("Start","\xffSMB",4), + fields_desc = [StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}), ByteField("Error_Class",0), ByteField("Reserved",0), @@ -221,7 +221,7 @@ class SMBNegociate_Protocol_Response_No_Security(Packet): # SMBNegociate Protocol Response No Security No Key class SMBNegociate_Protocol_Response_No_Security_No_Key(Packet): namez="SMBNegociate Protocol Response No Security No Key" - fields_desc = [StrFixedLenField("Start","\xffSMB",4), + fields_desc = [StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}), ByteField("Error_Class",0), ByteField("Reserved",0), @@ -261,7 +261,7 @@ class SMBNegociate_Protocol_Response_No_Security_No_Key(Packet): # Session Setup AndX Request class SMBSession_Setup_AndX_Request(Packet): name="Session Setup AndX Request" - fields_desc=[StrFixedLenField("Start","\xffSMB",4), + fields_desc=[StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x73,{0x73:"SMB_COM_SESSION_SETUP_ANDX"}), ByteField("Error_Class",0), ByteField("Reserved",0), @@ -312,7 +312,7 @@ class SMBSession_Setup_AndX_Request(Packet): # Session Setup AndX Response class SMBSession_Setup_AndX_Response(Packet): name="Session Setup AndX Response" - fields_desc=[StrFixedLenField("Start","\xffSMB",4), + fields_desc=[StrFixedLenField("Start",b"\xffSMB",4), ByteEnumField("Command",0x73,{0x73:"SMB_COM_SESSION_SETUP_ANDX"}), ByteField("Error_Class",0), ByteField("Reserved",0), diff --git a/scapy/layers/tls/basefields.py b/scapy/layers/tls/basefields.py index cfa98d6e832cccfaf93e7197898fca4d0bc5b1fa..c267d28a2a9014035a34369c8102d99057acf973 100644 --- a/scapy/layers/tls/basefields.py +++ b/scapy/layers/tls/basefields.py @@ -12,9 +12,9 @@ from scapy.fields import * _tls_type = { 20: "change_cipher_spec", - 21: "alert", - 22: "handshake", - 23: "application_data" } + 21: "alert", + 22: "handshake", + 23: "application_data" } _tls_version = { 0x0200: "SSLv2", 0x0300: "SSLv3", diff --git a/scapy/layers/tls/cert.py b/scapy/layers/tls/cert.py index 8f816267a8d938e4612f3cafdde842d600f4d2e5..13f23675377ea59c001cda1425ededc0f2c0f11d 100644 --- a/scapy/layers/tls/cert.py +++ b/scapy/layers/tls/cert.py @@ -127,7 +127,7 @@ class _PKIObjMaker(type): if obj_path is None: raise Exception(error_msg) - if (not '\x00' in obj_path) and os.path.isfile(obj_path): + if (not b'\x00' in obj_path) and os.path.isfile(obj_path): _size = os.path.getsize(obj_path) if _size > obj_max_size: raise Exception(error_msg) diff --git a/scapy/layers/tls/crypto/cipher_aead.py b/scapy/layers/tls/crypto/cipher_aead.py index 3b9d84a095bce3b6b1a25cc5d10af8f1e0d78ee6..dd759bb71f934ea2682c598ca5f8984ea9c7bf1f 100644 --- a/scapy/layers/tls/crypto/cipher_aead.py +++ b/scapy/layers/tls/crypto/cipher_aead.py @@ -60,10 +60,10 @@ class _AEADCipher(object): self.ready = {"key":True, "salt":True, "nonce_explicit":True} if key is None: self.ready["key"] = False - key = "\0" * self.key_len + key = b"\0" * self.key_len if salt is None: self.ready["salt"] = False - salt = "\0" * self.salt_len + salt = b"\0" * self.salt_len if nonce_explicit is None: self.ready["nonce_explicit"] = False nonce_explicit = 0 diff --git a/scapy/layers/tls/crypto/cipher_block.py b/scapy/layers/tls/crypto/cipher_block.py index 81dfb1dae489c55b1948aead1864e85fc56c4f5e..d34695b0c882c80156819a269f5b2c5b5cbd7df5 100644 --- a/scapy/layers/tls/crypto/cipher_block.py +++ b/scapy/layers/tls/crypto/cipher_block.py @@ -43,10 +43,10 @@ class _BlockCipher(object): l = self.expanded_key_len else: l = self.key_len - key = "\0" * l + key = b"\0" * l if iv is None or iv == "": self.ready["iv"] = False - iv = "\0" * self.block_size + iv = b"\0" * self.block_size # we use super() in order to avoid any deadlock with __setattr__ super(_BlockCipher, self).__setattr__("key", key) diff --git a/scapy/layers/tls/crypto/cipher_stream.py b/scapy/layers/tls/crypto/cipher_stream.py index 6bfd1a376a411bd71f30204f999ddac63bdfcb10..aa8e2a7f43751d5c508df6571d6a4ec617d8e265 100644 --- a/scapy/layers/tls/crypto/cipher_stream.py +++ b/scapy/layers/tls/crypto/cipher_stream.py @@ -46,7 +46,7 @@ class _StreamCipher(object): l = self.expanded_key_len else: l = self.key_len - key = "\0" * l + key = b"\0" * l # we use super() in order to avoid any deadlock with __setattr__ super(_StreamCipher, self).__setattr__("key", key) diff --git a/scapy/layers/tls/crypto/curves.py b/scapy/layers/tls/crypto/curves.py index 9a1d875e6930631e36693050da797891d431424b..bd6fe1222929964c73f4a600c9f37f4baed8dd75 100644 --- a/scapy/layers/tls/crypto/curves.py +++ b/scapy/layers/tls/crypto/curves.py @@ -29,7 +29,7 @@ format and additional curves). # x = pkcs_i2osp(point.x(), math.ceil(pLen/8)) # y = pkcs_i2osp(point.y(), math.ceil(pLen/8)) # if point_format == 0: -# frmt = '\x04' +# frmt = b'\x04' # elif point_format == 1: # frmt = chr(2 + y%2) # y = '' @@ -63,7 +63,7 @@ format and additional curves). # p = curve.p() # point_format = g[0] # point = g[1:] -# if point_format == '\x04': +# if point_format == b'\x04': # point_len = len(point) # if point_len % 2 != 0: # raise Exception("Point length is not even.") @@ -71,7 +71,7 @@ format and additional curves). # x = pkcs_os2ip(x_bytes) % p # y_bytes = point[point_len>>1:] # y = pkcs_os2ip(y_bytes) % p -# elif point_format in ['\x02', '\x03']: +# elif point_format in [b'\x02', b'\x03']: # x_bytes = point # x = pkcs_os2ip(x_bytes) % p # # perform the y coordinate computation with self.tls_ec diff --git a/scapy/layers/tls/crypto/h_mac.py b/scapy/layers/tls/crypto/h_mac.py index 6be3803b9c41b80050d7a2f5561d0415deddf6dd..911bbb053fcc85d23cceb430d8db8ffbcc276fcc 100644 --- a/scapy/layers/tls/crypto/h_mac.py +++ b/scapy/layers/tls/crypto/h_mac.py @@ -12,10 +12,10 @@ import hmac from scapy.layers.tls.crypto.hash import tls_hash_algs -SSLv3_PAD1_MD5 = "\x36"*48 -SSLv3_PAD1_SHA1 = "\x36"*40 -SSLv3_PAD2_MD5 = "\x5c"*48 -SSLv3_PAD2_SHA1 = "\x5c"*40 +SSLv3_PAD1_MD5 = b"\x36"*48 +SSLv3_PAD1_SHA1 = b"\x36"*40 +SSLv3_PAD2_MD5 = b"\x5c"*48 +SSLv3_PAD2_SHA1 = b"\x5c"*40 tls_hmac_algs = {} diff --git a/scapy/layers/tls/crypto/pkcs1.py b/scapy/layers/tls/crypto/pkcs1.py index e4b49c4104730f21f05acebae714e50699ac6986..eee8f52ac20c6320db544ed77d5920b88f9a1c69 100644 --- a/scapy/layers/tls/crypto/pkcs1.py +++ b/scapy/layers/tls/crypto/pkcs1.py @@ -103,27 +103,27 @@ if conf.crypto_valid: "md5" : (16, hashes.MD5, lambda x: _hashWrapper(hashes.MD5, x), - '\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10'), + b'\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10'), "sha1" : (20, hashes.SHA1, lambda x: _hashWrapper(hashes.SHA1, x), - '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14'), + b'\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14'), "sha224" : (28, hashes.SHA224, lambda x: _hashWrapper(hashes.SHA224, x), - '\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c'), + b'\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c'), "sha256" : (32, hashes.SHA256, lambda x: _hashWrapper(hashes.SHA256, x), - '\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20'), + b'\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20'), "sha384" : (48, hashes.SHA384, lambda x: _hashWrapper(hashes.SHA384, x), - '\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30'), + b'\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30'), "sha512" : (64, hashes.SHA512, lambda x: _hashWrapper(hashes.SHA512, x), - '\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40'), + b'\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40'), "tls" : (36, None, lambda x: _hashWrapper(hashes.MD5, x) + _hashWrapper(hashes.SHA1, x), @@ -210,21 +210,21 @@ def pkcs_emsa_pss_encode(M, emBits, h, mgf, sLen): warning("encoding error (emLen < hLen + sLen + 2)") return None salt = randstring(sLen) # 4) - MPrime = '\x00'*8 + mHash + salt # 5) + MPrime = b'\x00'*8 + mHash + salt # 5) H = hFunc(MPrime) # 6) - PS = '\x00'*(emLen - sLen - hLen - 2) # 7) - DB = PS + '\x01' + salt # 8) + PS = b'\x00'*(emLen - sLen - hLen - 2) # 7) + DB = PS + b'\x01' + salt # 8) dbMask = mgf(H, emLen - hLen - 1) # 9) maskedDB = strxor(DB, dbMask) # 10) l = (8*emLen - emBits)/8 # 11) rem = 8*emLen - emBits - 8*l # additionnal bits - andMask = l*'\x00' + andMask = l*b'\x00' if rem: j = chr(reduce(lambda x,y: x+y, map(lambda x: 1<<x, range(8-rem)))) andMask += j l += 1 maskedDB = strand(maskedDB[:l], andMask) + maskedDB[l:] - EM = maskedDB + H + '\xbc' # 12) + EM = maskedDB + H + b'\xbc' # 12) return EM # 13) @@ -253,36 +253,36 @@ def pkcs_emsa_pss_verify(M, EM, emBits, h, mgf, sLen): emLen = int(math.ceil(emBits/8.)) # 3) if emLen < hLen + sLen + 2: return False - if EM[-1] != '\xbc': # 4) + if EM[-1] != b'\xbc': # 4) return False l = emLen - hLen - 1 # 5) maskedDB = EM[:l] H = EM[l:l+hLen] l = (8*emLen - emBits)/8 # 6) rem = 8*emLen - emBits - 8*l # additionnal bits - andMask = l*'\xff' + andMask = l*b'\xff' if rem: val = reduce(lambda x,y: x+y, map(lambda x: 1<<x, range(8-rem))) j = chr(~val & 0xff) andMask += j l += 1 - if strand(maskedDB[:l], andMask) != '\x00'*l: + if strand(maskedDB[:l], andMask) != b'\x00'*l: return False dbMask = mgf(H, emLen - hLen - 1) # 7) DB = strxor(maskedDB, dbMask) # 8) l = (8*emLen - emBits)/8 # 9) rem = 8*emLen - emBits - 8*l # additionnal bits - andMask = l*'\x00' + andMask = l*b'\x00' if rem: j = chr(reduce(lambda x,y: x+y, map(lambda x: 1<<x, range(8-rem)))) andMask += j l += 1 DB = strand(DB[:l], andMask) + DB[l:] l = emLen - hLen - sLen - 1 # 10) - if DB[:l] != '\x00'*(l-1) + '\x01': + if DB[:l] != b'\x00'*(l-1) + b'\x01': return False salt = DB[-sLen:] # 11) - MPrime = '\x00'*8 + mHash + salt # 12) + MPrime = b'\x00'*8 + mHash + salt # 12) HPrime = hFunc(MPrime) # 13) return H == HPrime # 14) @@ -316,8 +316,8 @@ def pkcs_emsa_pkcs1_v1_5_encode(M, emLen, h): # section 9.2 of RFC 3447 warning("pkcs_emsa_pkcs1_v1_5_encode:" "intended encoded message length too short") return None - PS = '\xff'*(emLen - tLen - 3) # 4) - EM = '\x00' + '\x01' + PS + '\x00' + T # 5) + PS = b'\xff'*(emLen - tLen - 3) # 4) + EM = b'\x00' + b'\x01' + PS + b'\x00' + T # 5) return EM # 6) diff --git a/scapy/layers/tls/crypto/prf.py b/scapy/layers/tls/crypto/prf.py index 1f93f92569074352bfb156160ec3518e16b9e70c..829ead270ec4ef28ec9c0cc3c508d3b6433361d0 100644 --- a/scapy/layers/tls/crypto/prf.py +++ b/scapy/layers/tls/crypto/prf.py @@ -223,10 +223,10 @@ class PRF(object): d = {"client": "SRVR", "server": "CLNT"} label = d[con_end] - sslv3_md5_pad1 = "\x36"*48 - sslv3_md5_pad2 = "\x5c"*48 - sslv3_sha1_pad1 = "\x36"*40 - sslv3_sha1_pad2 = "\x5c"*40 + sslv3_md5_pad1 = b"\x36"*48 + sslv3_md5_pad2 = b"\x5c"*48 + sslv3_sha1_pad1 = b"\x36"*40 + sslv3_sha1_pad2 = b"\x5c"*40 md5 = tls_hash_algs["MD5"]() sha1 = tls_hash_algs["SHA"]() diff --git a/scapy/layers/tls/handshake.py b/scapy/layers/tls/handshake.py index 5ee9aaeaa6bc99ff2c58f7082800675041407ac7..2a90e4237b8131e35b195e8e5056b5a8b8ceebab 100644 --- a/scapy/layers/tls/handshake.py +++ b/scapy/layers/tls/handshake.py @@ -920,7 +920,7 @@ class _ASN1CertLenField(FieldLenField): return s + struct.pack(self.fmt, self.i2m(pkt,val))[1:4] def getfield(self, pkt, s): - return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00" + s[:3])[0]) + return s[3:], self.m2i(pkt, struct.unpack(self.fmt, b"\x00" + s[:3])[0]) class _ASN1CertListField(StrLenField): @@ -945,7 +945,7 @@ class _ASN1CertListField(StrLenField): if l is not None: m, ret = s[:l], s[l:] while m: - clen = struct.unpack("!I", '\x00' + m[:3])[0] + clen = struct.unpack("!I", b'\x00' + m[:3])[0] lst.append((clen, Cert(m[3:3 + clen]))) m = m[3 + clen:] return m + ret, lst @@ -1025,7 +1025,7 @@ class TLSServerKeyExchange(_TLSHandshake): server_kx_msg_cls does not matter. - ServerECDH*Params: for ephemeral ECDH. There are actually three classes, which are dispatched by _tls_server_ecdh_cls_guess on - the first byte retrieved. The default here is "\03", which + the first byte retrieved. The default here is b"\03", which corresponds to ServerECDHNamedCurveParams (implicit curves). When the Server*DHParams are built via .fill_missing(), the session @@ -1038,7 +1038,7 @@ class TLSServerKeyExchange(_TLSHandshake): if s.pwcs.key_exchange.export: cls = ServerRSAParams(tls_session=s) else: - cls = s.pwcs.key_exchange.server_kx_msg_cls("\x03") + cls = s.pwcs.key_exchange.server_kx_msg_cls(b"\x03") cls = cls(tls_session=s) try: cls.fill_missing() @@ -1366,7 +1366,7 @@ class ThreeBytesLenField(FieldLenField): def addfield(self, pkt, s, val): return s+struct.pack(self.fmt, self.i2m(pkt,val))[1:4] def getfield(self, pkt, s): - return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0]) + return s[3:], self.m2i(pkt, struct.unpack(self.fmt, b"\x00"+s[:3])[0]) _cert_status_cls = { 1: OCSP_Response } diff --git a/scapy/layers/tls/keyexchange.py b/scapy/layers/tls/keyexchange.py index cfff57b6408c1df21de7c1119196a5edd8dcebc0..6df124c52b315adc1a023712bab2b37c904713fd 100644 --- a/scapy/layers/tls/keyexchange.py +++ b/scapy/layers/tls/keyexchange.py @@ -405,19 +405,19 @@ class ServerECDHExplicitPrimeParams(_GenericTLSSessionInheritance): """ name = "Server ECDH parameters - Explicit Prime" fields_desc = [ ByteEnumField("curve_type", 1, _tls_ec_curve_types), - FieldLenField("plen", None, length_of="p", fmt="B"), - StrLenField("p", "", length_from=lambda pkt: pkt.plen), + FieldLenField("plen", None, length_of="p", fmt="B"), + StrLenField("p", "", length_from=lambda pkt: pkt.plen), PacketField("curve", None, ECCurvePkt), FieldLenField("baselen", None, length_of="base", fmt="B"), StrLenField("base", "", length_from=lambda pkt: pkt.baselen), - FieldLenField("orderlen", None, + FieldLenField("orderlen", None, length_of="order", fmt="B"), - StrLenField("order", "", + StrLenField("order", "", length_from=lambda pkt: pkt.orderlen), - FieldLenField("cofactorlen", None, + FieldLenField("cofactorlen", None, length_of="cofactor", fmt="B"), - StrLenField("cofactor", "", + StrLenField("cofactor", "", length_from=lambda pkt: pkt.cofactorlen), FieldLenField("pointlen", None, length_of="point", fmt="B"), @@ -555,7 +555,7 @@ class ServerECDHNamedCurveParams(_GenericTLSSessionInheritance): XXX Check that the pubkey received is on the curve. """ #point_format = 0 - #if self.point[0] in ['\x02', '\x03']: + #if self.point[0] in [b'\x02', b'\x03']: # point_format = 1 #if self.named_curve and self.point: #XXX remove this, probably @@ -747,7 +747,7 @@ class ClientECDiffieHellmanPublic(_GenericTLSSessionInheritance): pubkey = s.client_kx_privkey.public_key() x = pubkey.public_numbers().x y = pubkey.public_numbers().y - self.ecdh_Yc = ("\x04" + + self.ecdh_Yc = (b"\x04" + pkcs_i2osp(x, params.key_size/8) + pkcs_i2osp(y, params.key_size/8)) # else, we assume that the user wrote the client_kx_privkey by himself @@ -806,7 +806,7 @@ class EncryptedPreMasterSecret(_GenericTLSSessionInheritance): decrypted = s.server_rsa_key.decrypt(tbd) pms = decrypted[-48:] else: - pms = "\x00"*48 # Hack but we should not be there anyway + pms = b"\x00"*48 # Hack but we should not be there anyway err = "No server RSA key to decrypt Pre Master Secret. Skipping." warning(err) diff --git a/scapy/layers/x509.py b/scapy/layers/x509.py index b5b03c9b13724184a1799132c8a6a48dbd0c2cb1..ba713dfb5018997205d54bb6f9372827db5dd75a 100644 --- a/scapy/layers/x509.py +++ b/scapy/layers/x509.py @@ -269,7 +269,7 @@ class X509_ExtAuthorityKeyIdentifier(ASN1_Packet): ASN1_codec = ASN1_Codecs.BER ASN1_root = ASN1F_SEQUENCE( ASN1F_optional( - ASN1F_STRING("keyIdentifier", "\xff"*20, + ASN1F_STRING("keyIdentifier", b"\xff"*20, implicit_tag=0x80)), ASN1F_optional( ASN1F_SEQUENCE_OF("authorityCertIssuer", None, diff --git a/scapy/pton_ntop.py b/scapy/pton_ntop.py index 8e6e82039e68d8dfd31bff4fad9dba50e77cce83..536ee308d79875237b7faa13ababe8b5cd48c73c 100644 --- a/scapy/pton_ntop.py +++ b/scapy/pton_ntop.py @@ -24,7 +24,7 @@ used when socket.inet_pton is not available. joker_pos = None result = "" if addr == '::': - return '\x00' * 16 + return b'\x00' * 16 if addr.startswith('::'): addr = addr[1:] if addr.endswith('::'): @@ -43,7 +43,7 @@ used when socket.inet_pton is not available. # The last part of an IPv6 address can be an IPv4 address if part.count('.') != 3: # we have to do this since socket.inet_aton('1.2') == - # '\x01\x00\x00\x02' + # b'\x01\x00\x00\x02' raise _INET6_PTON_EXC try: result += socket.inet_aton(part) @@ -59,7 +59,7 @@ used when socket.inet_pton is not available. if joker_pos is not None: if len(result) == 16: raise _INET6_PTON_EXC - result = (result[:joker_pos] + "\x00" * (16 - len(result)) + result = (result[:joker_pos] + b"\x00" * (16 - len(result)) + result[joker_pos:]) if len(result) != 16: raise _INET6_PTON_EXC diff --git a/scapy/themes.py b/scapy/themes.py index a814159b04971f791f30be04f31cbea32f8d4905..c7d2a1ff5b78a186084823e27fa002ca3be7e8cb 100644 --- a/scapy/themes.py +++ b/scapy/themes.py @@ -12,20 +12,20 @@ Color themes for the interactive console. ################## class Color: - normal = "\033[0m" - black = "\033[30m" - red = "\033[31m" - green = "\033[32m" - yellow = "\033[33m" - blue = "\033[34m" - purple = "\033[35m" - cyan = "\033[36m" - grey = "\033[37m" + normal = b"\033[0m" + black = b"\033[30m" + red = b"\033[31m" + green = b"\033[32m" + yellow = b"\033[33m" + blue = b"\033[34m" + purple = b"\033[35m" + cyan = b"\033[36m" + grey = b"\033[37m" - bold = "\033[1m" - uline = "\033[4m" - blink = "\033[5m" - invert = "\033[7m" + bold = b"\033[1m" + uline = b"\033[4m" + blink = b"\033[5m" + invert = b"\033[7m" def create_styler(fmt=None, before="", after="", fmt2="%s"): @@ -268,7 +268,7 @@ class ColorPrompt: ct = config.conf.color_theme if isinstance(ct, AnsiColorTheme): ## ^A and ^B delimit invisible characters for readline to count right - return "\001%s\002" % ct.prompt("\002"+config.conf.prompt+"\001") + return b"\001%s\002" % ct.prompt(b"\002"+config.conf.prompt+b"\001") else: return ct.prompt(config.conf.prompt) except: diff --git a/scapy/tools/UTscapy.py b/scapy/tools/UTscapy.py index 46d52a93946c78af09f33b7e1ba7adb9450ba5d2..d19120c78e452e869b8266f2b51f857377c735ca 100755 --- a/scapy/tools/UTscapy.py +++ b/scapy/tools/UTscapy.py @@ -315,9 +315,9 @@ def compute_campaign_digests(test_campaign): for t in ts: dt = t.test.strip() t.crc = crc32(dt) - dts += "\0"+dt + dts += b"\0"+dt ts.crc = crc32(dts) - dc += "\0\x01"+dts + dc += b"\0\x01"+dts test_campaign.crc = crc32(dc) test_campaign.sha = sha1(open(test_campaign.filename).read()) diff --git a/scapy/utils.py b/scapy/utils.py index 58df161facaf922c1152fe547d0e9d41c5254829..e597c1724add7faeb973b5374ee2b73dd0d959b6 100644 --- a/scapy/utils.py +++ b/scapy/utils.py @@ -265,10 +265,10 @@ def hexdiff(x,y): else: i += 16 -if struct.pack("H",1) == "\x00\x01": # big endian +if struct.pack("H",1) == b"\x00\x01": # big endian def checksum(pkt): if len(pkt) % 2 == 1: - pkt += "\0" + pkt += b"\0" s = sum(array.array("H", pkt)) s = (s >> 16) + (s & 0xffff) s += s >> 16 @@ -277,7 +277,7 @@ if struct.pack("H",1) == "\x00\x01": # big endian else: def checksum(pkt): if len(pkt) % 2 == 1: - pkt += "\0" + pkt += b"\0" s = sum(array.array("H", pkt)) s = (s >> 16) + (s & 0xffff) s += s >> 16 @@ -323,7 +323,7 @@ def fletcher16_checkbytes(binbuf, offset): if len(binbuf) < offset: raise Exception("Packet too short for checkbytes %d" % len(binbuf)) - binbuf = binbuf[:offset] + "\x00\x00" + binbuf[offset + 2:] + binbuf = binbuf[:offset] + b"\x00\x00" + binbuf[offset + 2:] (c0,c1)= _fletcher16(binbuf) x = ((len(binbuf) - offset - 1) * c0 - c1) % 255 @@ -379,7 +379,7 @@ try: except socket.error: def inet_aton(x): if x == "255.255.255.255": - return "\xff"*4 + return b"\xff"*4 else: return socket.inet_aton(x) else: @@ -681,16 +681,16 @@ class RawPcapReader: def __init__(self, filename, fdesc, magic): self.filename = filename self.f = fdesc - if magic == "\xa1\xb2\xc3\xd4": # big endian + if magic == b"\xa1\xb2\xc3\xd4": # big endian self.endian = ">" self.nano = False - elif magic == "\xd4\xc3\xb2\xa1": # little endian + elif magic == b"\xd4\xc3\xb2\xa1": # little endian self.endian = "<" self.nano = False - elif magic == "\xa1\xb2\x3c\x4d": # big endian, nanosecond-precision + elif magic == b"\xa1\xb2\x3c\x4d": # big endian, nanosecond-precision self.endian = ">" self.nano = True - elif magic == "\x4d\x3c\xb2\xa1": # little endian, nanosecond-precision + elif magic == b"\x4d\x3c\xb2\xa1": # little endian, nanosecond-precision self.endian = "<" self.nano = True else: @@ -820,15 +820,15 @@ class RawPcapNgReader(RawPcapReader): 3: self.read_block_spb, 6: self.read_block_epb, } - if magic != "\x0a\x0d\x0d\x0a": # PcapNg: + if magic != b"\x0a\x0d\x0d\x0a": # PcapNg: raise Scapy_Exception( "Not a pcapng capture file (bad magic: %r)" % magic ) # see https://github.com/pcapng/pcapng blocklen, magic = self.f.read(4), self.f.read(4) - if magic == "\x1a\x2b\x3c\x4d": + if magic == b"\x1a\x2b\x3c\x4d": self.endian = ">" - elif magic == "\x4d\x3c\x2b\x1a": + elif magic == b"\x4d\x3c\x2b\x1a": self.endian = "<" else: raise Scapy_Exception("Not a pcapng capture file (bad magic)") diff --git a/scapy/utils6.py b/scapy/utils6.py index 3203e13c7cac2a89d5a29ba439e8a02267023f8d..cb78d2cf2dc0a4f2ed287a1f4e11954b57c6a9bb 100644 --- a/scapy/utils6.py +++ b/scapy/utils6.py @@ -163,9 +163,9 @@ def in6_getAddrType(addr): # is defined in RFC 3513 as those in 2000::/3 if ((struct.unpack("B", naddr[0])[0] & 0xE0) == 0x20): addrType = (IPV6_ADDR_UNICAST | IPV6_ADDR_GLOBAL) - if naddr[:2] == ' \x02': # Mark 6to4 @ + if naddr[:2] == b' \x02': # Mark 6to4 @ addrType |= IPV6_ADDR_6TO4 - elif naddr[0] == '\xff': # multicast + elif naddr[0] == b'\xff': # multicast addrScope = paddr[3] if addrScope == '2': addrType = (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_MULTICAST) @@ -173,7 +173,7 @@ def in6_getAddrType(addr): addrType = (IPV6_ADDR_GLOBAL | IPV6_ADDR_MULTICAST) else: addrType = (IPV6_ADDR_GLOBAL | IPV6_ADDR_MULTICAST) - elif ((naddr[0] == '\xfe') and ((int(paddr[2], 16) & 0xC) == 0x8)): + elif ((naddr[0] == b'\xfe') and ((int(paddr[2], 16) & 0xC) == 0x8)): addrType = (IPV6_ADDR_UNICAST | IPV6_ADDR_LINKLOCAL) elif paddr == "::1": addrType = IPV6_ADDR_LOOPBACK @@ -215,7 +215,7 @@ def in6_ifaceidtomac(ifaceid): # TODO: finish commenting function behavior ifaceid = inet_pton(socket.AF_INET6, "::"+ifaceid)[8:16] except: return None - if ifaceid[3:5] != '\xff\xfe': + if ifaceid[3:5] != b'\xff\xfe': return None first = struct.unpack("B", ifaceid[:1])[0] ulbit = 2*[1,'-',0][first & 0x02] @@ -264,7 +264,7 @@ def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2): By default, the function returns a ::/96 prefix (aka last 32 bits of returned address are null). If a group id is provided through 'grpid' parameter, last 32 bits of the address are set to that value (accepted - formats : '\x12\x34\x56\x78' or '12345678' or 0x12345678 or 305419896). + formats : b'\x12\x34\x56\x78' or '12345678' or 0x12345678 or 305419896). By default, generated address scope is Link-Local (2). That value can be modified by passing a specific 'scope' value as an argument of the @@ -287,7 +287,7 @@ def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2): iid = addr[8:] if grpid is None: - grpid = '\x00\x00\x00\x00' + grpid = b'\x00\x00\x00\x00' else: if type(grpid) is str: if len(grpid) == 8: @@ -305,9 +305,9 @@ def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2): grpid = struct.pack("!I", grpid) flgscope = struct.pack("B", 0xff & ((0x3 << 4) | scope)) - plen = '\xff' - res = '\x00' - a = '\xff' + flgscope + res + plen + iid + grpid + plen = b'\xff' + res = b'\x00' + a = b'\xff' + flgscope + res + plen + iid + grpid return inet_ntop(socket.AF_INET6, a) @@ -319,7 +319,7 @@ def in6_get6to4Prefix(addr): """ try: addr = inet_pton(socket.AF_INET, addr) - addr = inet_ntop(socket.AF_INET6, '\x20\x02'+addr+'\x00'*10) + addr = inet_ntop(socket.AF_INET6, b'\x20\x02'+addr+b'\x00'*10) except: return None return addr @@ -333,7 +333,7 @@ def in6_6to4ExtractAddr(addr): addr = inet_pton(socket.AF_INET6, addr) except: return None - if addr[:2] != " \x02": + if addr[:2] != b" \x02": return None return inet_ntop(socket.AF_INET, addr[2:6]) @@ -364,7 +364,7 @@ def in6_getLocalUniquePrefix(): eui64 = inet_pton(socket.AF_INET6, '::' + in6_mactoifaceid(mac))[8:] import sha globalid = sha.new(tod+eui64).digest()[:5] - return inet_ntop(socket.AF_INET6, '\xfd' + globalid + '\x00'*10) + return inet_ntop(socket.AF_INET6, b'\xfd' + globalid + b'\x00'*10) def in6_getRandomizedIfaceId(ifaceid, previous=None): """ @@ -398,8 +398,8 @@ def in6_getRandomizedIfaceId(ifaceid, previous=None): s = md5.new(s).digest() s1,s2 = s[:8],s[8:] s1 = chr(ord(s1[0]) | 0x04) + s1[1:] - s1 = inet_ntop(socket.AF_INET6, "\xff"*8 + s1)[20:] - s2 = inet_ntop(socket.AF_INET6, "\xff"*8 + s2)[20:] + s1 = inet_ntop(socket.AF_INET6, b"\xff"*8 + s1)[20:] + s2 = inet_ntop(socket.AF_INET6, b"\xff"*8 + s2)[20:] return (s1, s2) @@ -459,7 +459,7 @@ def in6_isaddr6to4(x): address (being in 2002::/16). """ x = inet_pton(socket.AF_INET6, x) - return x[:2] == ' \x02' + return x[:2] == b' \x02' conf.teredoPrefix = "2001::" # old one was 3ffe:831f (it is a /32) conf.teredoServerPort = 3544 @@ -485,8 +485,8 @@ def teredoAddrExtractInfo(x): addr = inet_pton(socket.AF_INET6, x) server = inet_ntop(socket.AF_INET, addr[4:8]) flag = struct.unpack("!H",addr[8:10])[0] - mappedport = struct.unpack("!H",strxor(addr[10:12],'\xff'*2))[0] - mappedaddr = inet_ntop(socket.AF_INET, strxor(addr[12:16],'\xff'*4)) + mappedport = struct.unpack("!H",strxor(addr[10:12],b'\xff'*2))[0] + mappedaddr = inet_ntop(socket.AF_INET, strxor(addr[12:16],b'\xff'*4)) return server, flag, mappedaddr, mappedport def in6_iseui64(x): @@ -556,7 +556,7 @@ def in6_cidr2mask(m): """ Return the mask (bitstring) associated with provided length value. For instance if function is called on 48, return value is - '\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'. + b'\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'. """ if m > 128 or m < 0: @@ -622,8 +622,8 @@ def in6_isllsnmaddr(str): multicast address, i.e. belongs to ff02::1:ff00:0/104. False is returned otherwise. """ - temp = in6_and("\xff"*13+"\x00"*3, inet_pton(socket.AF_INET6, str)) - temp2 = '\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x00\x00\x00' + temp = in6_and(b"\xff"*13+b"\x00"*3, inet_pton(socket.AF_INET6, str)) + temp2 = b'\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x00\x00\x00' return temp == temp2 def in6_isdocaddr(str): diff --git a/scapy/volatile.py b/scapy/volatile.py index 152eb5bf19a2a64ffefcbfef322f3a2bd68bfc75..0fd379df181119d8f03073816c28dbd6c04ae75f 100644 --- a/scapy/volatile.py +++ b/scapy/volatile.py @@ -574,10 +574,10 @@ class RandSingString(RandSingularity): "%", "%%%", "A"*4096, - "\x00"*4096, - "\xff"*4096, - "\x7f"*4096, - "\x80"*4096, + b"\x00"*4096, + b"\xff"*4096, + b"\x7f"*4096, + b"\x80"*4096, " "*4096, "\\"*4096, "("*4096, @@ -594,7 +594,7 @@ class RandSingString(RandSingularity): "$(reboot)", "`reboot`", "index.php%00", - "\x00", + b"\x00", "%00", "\\", "../../../../../../../../../../../../../../../../../etc/passwd", diff --git a/test/bluetooth.uts b/test/bluetooth.uts index 5de37a7d1c4bb0b7be7e6268d52b874dfa358e2b..3ac5acad9852770ac17fd65ea7d51c2f827a7d44 100644 --- a/test/bluetooth.uts +++ b/test/bluetooth.uts @@ -51,5 +51,5 @@ scan_resp_raw_data = \ "3134374432343631fc00030c0000de".decode('hex') scapy_packet = HCI_Hdr(scan_resp_raw_data) -assert(scapy_packet[EIR_Manufacturer_Specific_Data].data == '\x00_B31147D2461\xfc\x00\x03\x0c\x00\x00') +assert(scapy_packet[EIR_Manufacturer_Specific_Data].data == b'\x00_B31147D2461\xfc\x00\x03\x0c\x00\x00') assert(scapy_packet[EIR_Manufacturer_Specific_Data].company_id == 0x154) diff --git a/test/bpf.uts b/test/bpf.uts index 13ca7d27dcdbbe12dc25fb4e30c2d45a79b9554e..79c625c13158dcb383b3c0e64831186dccfe65a8 100644 --- a/test/bpf.uts +++ b/test/bpf.uts @@ -18,7 +18,7 @@ get_if_raw_hwaddr(conf.iface) = Get the packed MAC address of LOOPBACK_NAME -get_if_raw_hwaddr(LOOPBACK_NAME) == (ARPHDR_LOOPBACK, '\x00'*6) +get_if_raw_hwaddr(LOOPBACK_NAME) == (ARPHDR_LOOPBACK, b'\x00'*6) ############ diff --git a/test/cert.uts b/test/cert.uts index af3f041ce92ec3c5a9b0fcd8a14c9afaf28df6c7..474ae927bc899a52dc265bf7c273b10797785305 100644 --- a/test/cert.uts +++ b/test/cert.uts @@ -10,10 +10,10 @@ + PKCS helpers tests = PKCS os2ip basic tests -pkcs_os2ip('\x00\x00\xff\xff') == 0xffff and pkcs_os2ip('\xff\xff\xff\xff\xff') == 0xffffffffff +pkcs_os2ip(b'\x00\x00\xff\xff') == 0xffff and pkcs_os2ip(b'\xff\xff\xff\xff\xff') == 0xffffffffff = PKCS i2osp basic tests -pkcs_i2osp(0xffff, 4) == '\x00\x00\xff\xff' and pkcs_i2osp(0xffff, 2) == '\xff\xff' and pkcs_i2osp(0xffffeeee, 3) == '\xff\xff\xee\xee' +pkcs_i2osp(0xffff, 4) == b'\x00\x00\xff\xff' and pkcs_i2osp(0xffff, 2) == b'\xff\xff' and pkcs_i2osp(0xffffeeee, 3) == b'\xff\xff\xee\xee' ########### PubKey class ############################################### @@ -39,7 +39,7 @@ type(x) is PubKeyRSA x.frmt == "PEM" = PubKey class : Importing DER-encoded RSA Key -y = PubKey('0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\x98Wj?\xe9\xd3\x11\x9b\xa4KIK?\xec\xa3\xd6\x03H\x9a\xc1\x08\x7f\xb3\xf6\xc9$\xee\x9d\xc7\x98\xc7\t&\xe1Q9A\x17\x83m\xbd\x8b\xe7\xf1\xcb\x03\xdaO\x98\x87\x90-*\xbf\x06\x03\xb5\x99\xe3\x9cl\xe4\x89\xd9\x85GCo\x0cC\x9e\xbe\xf0*\xdb\xea}\xbc\x8b\'\x17\xe2\x1at\x1fp1D\x08\xe1\xd1\xe7W\xfa\xad\xf2\x8a[\xd8\'\x85\xbd\xfc\xd9\xc8o\xfc\x00g\x04\xb4\xa0\x98\x9f\xfe\xd4\xe4T^\xfb\x1f&\xc0|\x97^\xe4J\x9b\xa7\xe6\xc2(\x8b\xccZv\xa6n\x1fCEL\xa3\xac\x10Y\xa3\x97@\xd6\x8d\xf6\xce\x9b\x85\x06\xb2]#\xc7fR\x9c=\x82\xd7\xf4\x17@Z\xf2Q\x99\x9b\xc5*sA\xb2]\xe5\xce%A6\xbb\xb0\xa22\xed\xcc\xef\xb0L\xe9\x92\xcbM\xca0\xe7\xe6\xd0"i&L\xbdR\x1a\x1c\xf0~)\xcc\x13W\xba\xa7q\xe6\xff\xfaC\x8e\xe2o\x15\xa66\xdaM9.\x02\xee\xca\xa79\xf6\xf1b\x07t\xe8\x95\xdc\xfc\xf8\x06\xcc6;\xf3\x03\x02\x03\x01\x00\x01') +y = PubKey(b'0\x82\x01\"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\x98Wj?\xe9\xd3\x11\x9b\xa4KIK?\xec\xa3\xd6\x03H\x9a\xc1\x08\x7f\xb3\xf6\xc9$\xee\x9d\xc7\x98\xc7\t&\xe1Q9A\x17\x83m\xbd\x8b\xe7\xf1\xcb\x03\xdaO\x98\x87\x90-*\xbf\x06\x03\xb5\x99\xe3\x9cl\xe4\x89\xd9\x85GCo\x0cC\x9e\xbe\xf0*\xdb\xea}\xbc\x8b\'\x17\xe2\x1at\x1fp1D\x08\xe1\xd1\xe7W\xfa\xad\xf2\x8a[\xd8\'\x85\xbd\xfc\xd9\xc8o\xfc\x00g\x04\xb4\xa0\x98\x9f\xfe\xd4\xe4T^\xfb\x1f&\xc0|\x97^\xe4J\x9b\xa7\xe6\xc2(\x8b\xccZv\xa6n\x1fCEL\xa3\xac\x10Y\xa3\x97@\xd6\x8d\xf6\xce\x9b\x85\x06\xb2]#\xc7fR\x9c=\x82\xd7\xf4\x17@Z\xf2Q\x99\x9b\xc5*sA\xb2]\xe5\xce%A6\xbb\xb0\xa22\xed\xcc\xef\xb0L\xe9\x92\xcbM\xca0\xe7\xe6\xd0\"i&L\xbdR\x1a\x1c\xf0~)\xcc\x13W\xba\xa7q\xe6\xff\xfaC\x8e\xe2o\x15\xa66\xdaM9.\x02\xee\xca\xa79\xf6\xf1b\x07t\xe8\x95\xdc\xfc\xf8\x06\xcc6;\xf3\x03\x02\x03\x01\x00\x01') y_pubNum = y.pubkey.public_numbers() type(y) is PubKeyRSA @@ -143,7 +143,7 @@ y.key.private_numbers().private_value == 907197864312630821346709366701808397820 = PKCS 1 legacy : RSA signature & verification m = "Testing our PKCS #1 legacy methods" s = x.sign_legacy(m, t="pkcs", h="tls") -assert(s == "\x0cm\x8a\x8f\xae`o\xcdC=\xfea\xf4\xff\xf0i\xfe\xa3!\xfd\xa5=*\x99?\x08!\x03A~\xa3-B\xe8\xca\xaf\xb4H|\xa3\x98\xe9\xd5U\xfdL\xb1\x9c\xd8\xb2{\xa1/\xfcr\x8c\xa7\xd3\xa9%\xde\x13\xa8\xf6\xc6<\xc7\xdb\xe3\xa62\xeb\xe9?\xe5by\xc2\x9e\xad\xec\x92:\x14\xd96\xa8\xc0+\xea8'{=\x91$\xdf\xed\xe1+eF8\x9fI\x1f\xa1\xcb4s\xd1#\xdf\xa11\x88o\x050i Hg\x0690\xe6\xe8?\\<:k\x94\x82\x91\x0f\x06\xc7>ZQ\xc2\xcdn\xdb\xf4\x9d\x7f!\xa9>\xe8\xea\xb3\xd83]\x8d\x90\xd4\xa0b\xe6\xe6$d[\xe4\xb4 |W\xb2t\x8c\xb2\xd5>>+\xf1\xa6W'\xaf\xc2CU\x82\x13\xc4\x0b\xc4vD*\xc3\xef\xa6s\nQ\xe6\rS@B\xd2\xa4V\xdc\xd1D\x7f\x00\xaa\xac\xac\x96i\xf1kg*\xe9*\x90a@\xc8uDy\x16\xe2\x03\xd1\x9fa\xe2s\xdb\xees\xa4\x8cna\xba\xdaE\x006&\xa4") +assert(s == b"\x0cm\x8a\x8f\xae`o\xcdC=\xfea\xf4\xff\xf0i\xfe\xa3!\xfd\xa5=*\x99?\x08!\x03A~\xa3-B\xe8\xca\xaf\xb4H|\xa3\x98\xe9\xd5U\xfdL\xb1\x9c\xd8\xb2{\xa1/\xfcr\x8c\xa7\xd3\xa9%\xde\x13\xa8\xf6\xc6<\xc7\xdb\xe3\xa62\xeb\xe9?\xe5by\xc2\x9e\xad\xec\x92:\x14\xd96\xa8\xc0+\xea8\'{=\x91$\xdf\xed\xe1+eF8\x9fI\x1f\xa1\xcb4s\xd1#\xdf\xa11\x88o\x050i Hg\x0690\xe6\xe8?\\<:k\x94\x82\x91\x0f\x06\xc7>ZQ\xc2\xcdn\xdb\xf4\x9d\x7f!\xa9>\xe8\xea\xb3\xd83]\x8d\x90\xd4\xa0b\xe6\xe6$d[\xe4\xb4 |W\xb2t\x8c\xb2\xd5>>+\xf1\xa6W\'\xaf\xc2CU\x82\x13\xc4\x0b\xc4vD*\xc3\xef\xa6s\nQ\xe6\rS@B\xd2\xa4V\xdc\xd1D\x7f\x00\xaa\xac\xac\x96i\xf1kg*\xe9*\x90a@\xc8uDy\x16\xe2\x03\xd1\x9fa\xe2s\xdb\xees\xa4\x8cna\xba\xdaE\x006&\xa4") x_pub = PubKey((x._pubExp, x._modulus, x._modulusLen)) x_pub.verify_legacy(m, s, t="pkcs", h="tls") @@ -217,7 +217,7 @@ x_pubNum.e == 0x10001 = Cert class : Checking extensions assert(x.cA) -assert(x.authorityKeyID == '\xf3\xd8N\xde\x90\xf7\xe6]\xd2\xce3\xcd\\V\x8co\x97\x141K') +assert(x.authorityKeyID == b'\xf3\xd8N\xde\x90\xf7\xe6]\xd2\xce3\xcd\\V\x8co\x97\x141K') not hasattr(x, "keyUsage") = Cert class : Importing another PEM-encoded X.509 Certificate @@ -246,7 +246,7 @@ assert(pubkey.curve.name == 'secp384r1') pubkey.public_numbers().x == 3987178688175281746349180015490646948656137448666005327832107126183726641822596270780616285891030558662603987311874L = Cert class : Checking ECDSA signature -y.signatureValue == '0d\x020%\xa4\x81E\x02k\x12KutO\xc8#\xe3p\xf2ur\xde|\x89\xf0\xcf\x91ra\x9e^\x10\x92YV\xb9\x83\xc7\x10\xe78\xe9X&6}\xd5\xe44\x869\x020|6S\xf00\xe5bc:\x99\xe2\xb6\xa3;\x9b4\xfa\x1e\xda\x10\x92q^\x91\x13\xa7\xdd\xa4n\x92\xcc2\xd6\xf5!f\xc7/\xea\x96cjeE\x92\x95\x01\xb4' +y.signatureValue == b'0d\x020%\xa4\x81E\x02k\x12KutO\xc8#\xe3p\xf2ur\xde|\x89\xf0\xcf\x91ra\x9e^\x10\x92YV\xb9\x83\xc7\x10\xe78\xe9X&6}\xd5\xe44\x869\x020|6S\xf00\xe5bc:\x99\xe2\xb6\xa3;\x9b4\xfa\x1e\xda\x10\x92q^\x91\x13\xa7\xdd\xa4n\x92\xcc2\xd6\xf5!f\xc7/\xea\x96cjeE\x92\x95\x01\xb4' ########### CRL class ############################################### diff --git a/test/dnssecRR.uts b/test/dnssecRR.uts index b9c0ac89521504918297818a98a94cd90a947d97..fa2d03033266bd2f1b53dda839d2cf0b2aca8e7d 100644 --- a/test/dnssecRR.uts +++ b/test/dnssecRR.uts @@ -6,100 +6,100 @@ + bitmap2RRlist() = example from RFC 4034 -RRlist2bitmap([1, 15, 46, 47, 1234]) == '\x00\x06@\x01\x00\x00\x00\x03\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20' +RRlist2bitmap([1, 15, 46, 47, 1234]) == b'\x00\x06@\x01\x00\x00\x00\x03\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20' = [0] -RRlist2bitmap([0]) == '\x00\x01\x80' +RRlist2bitmap([0]) == b'\x00\x01\x80' = [0,1,2,3,4,5,6,7] -RRlist2bitmap([0,1,2,3,4,5,6,7]) == '\x00\x01\xff' +RRlist2bitmap([0,1,2,3,4,5,6,7]) == b'\x00\x01\xff' = [256,512,4096,36864] -RRlist2bitmap([256,512,4096,36864]) == '\x01\x01\x80\x02\x01\x80\x10\x01\x80\x90\x01\x80' +RRlist2bitmap([256,512,4096,36864]) == b'\x01\x01\x80\x02\x01\x80\x10\x01\x80\x90\x01\x80' = [65535] -RRlist2bitmap([65535]) == '\xff\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +RRlist2bitmap([65535]) == b'\xff\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' + From RRlist2bitmap() to bitmap2RRlist() = example from RFC 4034 -b = '\x00\x06@\x01\x00\x00\x00\x03\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20' +b = b'\x00\x06@\x01\x00\x00\x00\x03\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20' RRlist2bitmap(bitmap2RRlist(b)) == b = [0] -b= '\x00\x01\x80' +b= b'\x00\x01\x80' RRlist2bitmap(bitmap2RRlist(b)) == b = [0,1,2,3,4,5,6,7] -b = '\x00\x01\xff' +b = b'\x00\x01\xff' RRlist2bitmap(bitmap2RRlist(b)) == b = [256,512,4096,36864] -b = '\x01\x01\x80\x02\x01\x80\x10\x01\x80\x90\x01\x80' +b = b'\x01\x01\x80\x02\x01\x80\x10\x01\x80\x90\x01\x80' RRlist2bitmap(bitmap2RRlist(b)) == b = [65535] -b = '\xff\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +b = b'\xff\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' RRlist2bitmap(bitmap2RRlist(b)) == b + Test NSEC RR = DNSRRNSEC(), basic instanciation t = DNSRRNSEC() -str(t) == '\x00\x00/\x00\x01\x00\x00\x00\x00\x00\x01\x00' +str(t) == b'\x00\x00/\x00\x01\x00\x00\x00\x00\x00\x01\x00' = DNSRRRNSEC(), check parameters t = DNSRRNSEC(rrname="scapy.secdev.org.", rclass=42, ttl=28, nextname="www.secdev.org.", typebitmaps=RRlist2bitmap([1,2,3,4,1234])) -str(t) == '\x05scapy\x06secdev\x03org\x00\x00/\x00*\x00\x00\x00\x1c\x000\x03www\x06secdev\x03org\x00\x00\x01x\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ' +str(t) == b'\x05scapy\x06secdev\x03org\x00\x00/\x00*\x00\x00\x00\x1c\x000\x03www\x06secdev\x03org\x00\x00\x01x\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ' + Test NSEC3 RR = DNSRRNSEC3(), basic instanciation t = DNSRRNSEC3() -str(t) == '\x00\x002\x00\x01\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00' +str(t) == b'\x00\x002\x00\x01\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00' = DNSRRRNSEC3(), check parameters -t = DNSRRNSEC3(rrname="scapy.secdev.org.", rclass=42, ttl=28, hashalg=7, iterations=80, saltlength=28, salt="\x28\x07", hashlength=31, nexthashedownername="XXX.scapy.secdev.org", typebitmaps=RRlist2bitmap([1,2,3,4,1234])) -str(t) == '\x05scapy\x06secdev\x03org\x00\x002\x00*\x00\x00\x00\x1c\x00<\x07\x00\x00P\x1c(\x07\x1fXXX.scapy.secdev.org\x00\x01x\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ' +t = DNSRRNSEC3(rrname="scapy.secdev.org.", rclass=42, ttl=28, hashalg=7, iterations=80, saltlength=28, salt=b"\x28\x07", hashlength=31, nexthashedownername="XXX.scapy.secdev.org", typebitmaps=RRlist2bitmap([1,2,3,4,1234])) +str(t) == b'\x05scapy\x06secdev\x03org\x00\x002\x00*\x00\x00\x00\x1c\x00<\x07\x00\x00P\x1c(\x07\x1fXXX.scapy.secdev.org\x00\x01x\x04\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 ' + Test NSEC3PARAM RR = DNSRRNSEC3PARAM(), basic instanciation t = DNSRRNSEC3PARAM() -str(t) == '\x00\x003\x00\x01\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00' +str(t) == b'\x00\x003\x00\x01\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00' = DNSRRRNSEC3PARAM(), check parameters -t = DNSRRNSEC3(rrname="scapy.secdev.org.", rclass=42, ttl=28, hashalg=7, flags=80, iterations=80, saltlength=28, salt="\x28\x07") -str(t) == '\x05scapy\x06secdev\x03org\x00\x002\x00*\x00\x00\x00\x1c\x00\x08\x07P\x00P\x1c(\x07\x00' +t = DNSRRNSEC3(rrname="scapy.secdev.org.", rclass=42, ttl=28, hashalg=7, flags=80, iterations=80, saltlength=28, salt=b"\x28\x07") +str(t) == b'\x05scapy\x06secdev\x03org\x00\x002\x00*\x00\x00\x00\x1c\x00\x08\x07P\x00P\x1c(\x07\x00' + Test RRSIG RR = DNSRRRSIG(), basic instanciation t = DNSRRRSIG() -str(t) == '\x00\x00.\x00\x01\x00\x00\x00\x00\x00\x13\x00\x01\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(t) == b'\x00\x00.\x00\x01\x00\x00\x00\x00\x00\x13\x00\x01\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DNSRRRSIG(), check parameters t = DNSRRRSIG(rrname="test.example.com.", type=46, rclass=12, ttl=64, originalttl=2807, keytag=42, signersname="test.rsig", signature="test RSIG") -str(t) == '\x04test\x07example\x03com\x00\x00.\x00\x0c\x00\x00\x00@\x00&\x00\x01\x05\x00\x00\x00\n\xf7\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x04test\x04rsig\x00test RSIG' +str(t) == b'\x04test\x07example\x03com\x00\x00.\x00\x0c\x00\x00\x00@\x00&\x00\x01\x05\x00\x00\x00\n\xf7\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x04test\x04rsig\x00test RSIG' = DNSRRRSIG(), dissection -rrsig = '\x03isc\x03org\x00\x00.\x00\x01\x00\x00\x96O\x00\x9b\x00\x02\x05\x02\x00\x00\xa8\xc0K-3\xd9K\x05\xa6\xd9\xed6\x03isc\x03org\x00\xac\xb2_I\x9e\xdcU\xca/3\x1c\xdf{\xba\xd5\x80\xb0 \xa4~\x98\x95\xab~\x84\xb2\x1f9\x17#\x7f\xfeP\xb9\xfb\x8d\x13\x19\xd7\x7f\x9e/\x1c\xd7rv<\xc6\xd3\xf1\xae8\rh\xba\x1e\xaa\xe6\xf1\x1e\x1d\xdaS\xd4\\\xfd\xa3`P\xa1\xe0\xa2\x860\xd4?\xb4}j\x81O\x03\xdc&v\x13\xd4(k\xa07\x8f-\x08e\x06\xff\xb8h\x8f\x16j\xe4\xd92\xd2\x99\xc2\xb4' +rrsig = b'\x03isc\x03org\x00\x00.\x00\x01\x00\x00\x96O\x00\x9b\x00\x02\x05\x02\x00\x00\xa8\xc0K-3\xd9K\x05\xa6\xd9\xed6\x03isc\x03org\x00\xac\xb2_I\x9e\xdcU\xca/3\x1c\xdf{\xba\xd5\x80\xb0 \xa4~\x98\x95\xab~\x84\xb2\x1f9\x17#\x7f\xfeP\xb9\xfb\x8d\x13\x19\xd7\x7f\x9e/\x1c\xd7rv<\xc6\xd3\xf1\xae8\rh\xba\x1e\xaa\xe6\xf1\x1e\x1d\xdaS\xd4\\\xfd\xa3`P\xa1\xe0\xa2\x860\xd4?\xb4}j\x81O\x03\xdc&v\x13\xd4(k\xa07\x8f-\x08e\x06\xff\xb8h\x8f\x16j\xe4\xd92\xd2\x99\xc2\xb4' t = DNSRRRSIG(rrsig) -t.rrname == 'isc.org.' and t.labels == 2 and t.keytag == 60726 and t.signature[-4:] == '\xd2\x99\xc2\xb4' +t.rrname == 'isc.org.' and t.labels == 2 and t.keytag == 60726 and t.signature[-4:] == b'\xd2\x99\xc2\xb4' + Test DNSKEY RR = DNSRRDNSKEY(), basic instanciation t = DNSRRDNSKEY() -str(t) == '\x00\x000\x00\x01\x00\x00\x00\x00\x00\x04\x01\x00\x03\x05' and t.sprintf("%flags%") == 'Z' +str(t) == b'\x00\x000\x00\x01\x00\x00\x00\x00\x00\x04\x01\x00\x03\x05' and t.sprintf("%flags%") == 'Z' = DNSRRDNSKEY(), check parameters t = DNSRRDNSKEY(rrname="www.secdev.org.", type=42, rclass=12, ttl=1234, rdlen=567, flags=2807, protocol=195, algorithm=66, publickey="strong public key") -str(t) == '\x03www\x06secdev\x03org\x00\x00*\x00\x0c\x00\x00\x04\xd2\x027\n\xf7\xc3Bstrong public key' +str(t) == b'\x03www\x06secdev\x03org\x00\x00*\x00\x0c\x00\x00\x04\xd2\x027\n\xf7\xc3Bstrong public key' = DNSRRDNSKEY(), dissection -t = DNSRRDNSKEY('\x03dlv\x03isc\x03org\x00\x000\x00\x01\x00\x00\x1bq\x01\t\x01\x01\x03\x05\x04@\x00\x00\x03\xc72\xef\xf9\xa2|\xeb\x10N\xf3\xd5\xe8&\x86\x0f\xd6<\xed>\x8e\xea\x19\xadm\xde\xb9a\'\xe0\xccC\x08M~\x94\xbc\xb6n\xb8P\xbf\x9a\xcd\xdfdJ\xb4\xcc\xd7\xe8\xc8\xfb\xd27sx\xd0\xf8^I\xd6\xe7\xc7g$\xd3\xc2\xc6\x7f>\x8c\x01\xa5\xd8VK+\xcb~\xd6\xea\xb8[\xe9\xe7\x03z\x8e\xdb\xe0\xcb\xfaN\x81\x0f\x89\x9e\xc0\xc2\xdb!\x81p{C\xc6\xeft\xde\xf5\xf6v\x90\x96\xf9\xe9\xd8`1\xd7\xb9\xcae\xf8\x04\x8f\xe8C\xe7\x00+\x9d?\xc6\xf2o\xd3Ak\x7f\xc90\xea\xe7\x0cO\x01e\x80\xf7\xbe\x8eq\xb1<\xf1&\x1c\x0b^\xfdDdc\xad\x99~B\xe8\x04\x00\x03,t="\xb4\xb6\xb6\xbc\x80{\xb9\x9b\x05\x95\\;\x02\x1eS\xf4p\xfedq\xfe\xfc00$\xe05\xba\x0c@\xabTv\xf3W\x0e\xb6\t\r!\xd9\xc2\xcd\xf1\x89\x15\xc5\xd5\x17\xfej_T\x99\x97\xd2j\xff\xf85b\xca\x8c|\xe9O\x9fd\xfdT\xadL3taK\x96\xac\x13a') -t.rrname == "dlv.isc.org." and t.rdlen == 265 and t.sprintf("%flags%") == 'SZ' and t.publickey == '\x04@\x00\x00\x03\xc72\xef\xf9\xa2|\xeb\x10N\xf3\xd5\xe8&\x86\x0f\xd6<\xed>\x8e\xea\x19\xadm\xde\xb9a\'\xe0\xccC\x08M~\x94\xbc\xb6n\xb8P\xbf\x9a\xcd\xdfdJ\xb4\xcc\xd7\xe8\xc8\xfb\xd27sx\xd0\xf8^I\xd6\xe7\xc7g$\xd3\xc2\xc6\x7f>\x8c\x01\xa5\xd8VK+\xcb~\xd6\xea\xb8[\xe9\xe7\x03z\x8e\xdb\xe0\xcb\xfaN\x81\x0f\x89\x9e\xc0\xc2\xdb!\x81p{C\xc6\xeft\xde\xf5\xf6v\x90\x96\xf9\xe9\xd8`1\xd7\xb9\xcae\xf8\x04\x8f\xe8C\xe7\x00+\x9d?\xc6\xf2o\xd3Ak\x7f\xc90\xea\xe7\x0cO\x01e\x80\xf7\xbe\x8eq\xb1<\xf1&\x1c\x0b^\xfdDdc\xad\x99~B\xe8\x04\x00\x03,t="\xb4\xb6\xb6\xbc\x80{\xb9\x9b\x05\x95\\;\x02\x1eS\xf4p\xfedq\xfe\xfc00$\xe05\xba\x0c@\xabTv\xf3W\x0e\xb6\t\r!\xd9\xc2\xcd\xf1\x89\x15\xc5\xd5\x17\xfej_T\x99\x97\xd2j\xff\xf85b\xca\x8c|\xe9O\x9fd\xfdT\xadL3taK\x96\xac\x13a' +t = DNSRRDNSKEY(b'\x03dlv\x03isc\x03org\x00\x000\x00\x01\x00\x00\x1bq\x01\t\x01\x01\x03\x05\x04@\x00\x00\x03\xc72\xef\xf9\xa2|\xeb\x10N\xf3\xd5\xe8&\x86\x0f\xd6<\xed>\x8e\xea\x19\xadm\xde\xb9a\'\xe0\xccC\x08M~\x94\xbc\xb6n\xb8P\xbf\x9a\xcd\xdfdJ\xb4\xcc\xd7\xe8\xc8\xfb\xd27sx\xd0\xf8^I\xd6\xe7\xc7g$\xd3\xc2\xc6\x7f>\x8c\x01\xa5\xd8VK+\xcb~\xd6\xea\xb8[\xe9\xe7\x03z\x8e\xdb\xe0\xcb\xfaN\x81\x0f\x89\x9e\xc0\xc2\xdb!\x81p{C\xc6\xeft\xde\xf5\xf6v\x90\x96\xf9\xe9\xd8`1\xd7\xb9\xcae\xf8\x04\x8f\xe8C\xe7\x00+\x9d?\xc6\xf2o\xd3Ak\x7f\xc90\xea\xe7\x0cO\x01e\x80\xf7\xbe\x8eq\xb1<\xf1&\x1c\x0b^\xfdDdc\xad\x99~B\xe8\x04\x00\x03,t="\xb4\xb6\xb6\xbc\x80{\xb9\x9b\x05\x95\\;\x02\x1eS\xf4p\xfedq\xfe\xfc00$\xe05\xba\x0c@\xabTv\xf3W\x0e\xb6\t\r!\xd9\xc2\xcd\xf1\x89\x15\xc5\xd5\x17\xfej_T\x99\x97\xd2j\xff\xf85b\xca\x8c|\xe9O\x9fd\xfdT\xadL3taK\x96\xac\x13a') +t.rrname == "dlv.isc.org." and t.rdlen == 265 and t.sprintf("%flags%") == 'SZ' and t.publickey == b'\x04@\x00\x00\x03\xc72\xef\xf9\xa2|\xeb\x10N\xf3\xd5\xe8&\x86\x0f\xd6<\xed>\x8e\xea\x19\xadm\xde\xb9a\'\xe0\xccC\x08M~\x94\xbc\xb6n\xb8P\xbf\x9a\xcd\xdfdJ\xb4\xcc\xd7\xe8\xc8\xfb\xd27sx\xd0\xf8^I\xd6\xe7\xc7g$\xd3\xc2\xc6\x7f>\x8c\x01\xa5\xd8VK+\xcb~\xd6\xea\xb8[\xe9\xe7\x03z\x8e\xdb\xe0\xcb\xfaN\x81\x0f\x89\x9e\xc0\xc2\xdb!\x81p{C\xc6\xeft\xde\xf5\xf6v\x90\x96\xf9\xe9\xd8`1\xd7\xb9\xcae\xf8\x04\x8f\xe8C\xe7\x00+\x9d?\xc6\xf2o\xd3Ak\x7f\xc90\xea\xe7\x0cO\x01e\x80\xf7\xbe\x8eq\xb1<\xf1&\x1c\x0b^\xfdDdc\xad\x99~B\xe8\x04\x00\x03,t="\xb4\xb6\xb6\xbc\x80{\xb9\x9b\x05\x95\\;\x02\x1eS\xf4p\xfedq\xfe\xfc00$\xe05\xba\x0c@\xabTv\xf3W\x0e\xb6\t\r!\xd9\xc2\xcd\xf1\x89\x15\xc5\xd5\x17\xfej_T\x99\x97\xd2j\xff\xf85b\xca\x8c|\xe9O\x9fd\xfdT\xadL3taK\x96\xac\x13a' + Test DS and DLV RR @@ -109,8 +109,8 @@ dlv = DNSRRDLV(type=43) str(ds) == str(dlv) = DNSRRDS(), check parameters -t = DNSRRDS('\x03isc\x03org\x00\x00+\x00\x01\x00\x01Q(\x00\x182\\\x05\x01\x98!\x13\xd0\x8bLj\x1d\x9fj\xee\x1e"7\xae\xf6\x9f?\x97Y') -t.rrname == 'isc.org.' and t.keytag == 12892 and t.algorithm == 5 and t.digesttype == 1 and t.digest == '\x98!\x13\xd0\x8bLj\x1d\x9fj\xee\x1e"7\xae\xf6\x9f?\x97Y' +t = DNSRRDS(b'\x03isc\x03org\x00\x00+\x00\x01\x00\x01Q(\x00\x182\\\x05\x01\x98!\x13\xd0\x8bLj\x1d\x9fj\xee\x1e"7\xae\xf6\x9f?\x97Y') +t.rrname == 'isc.org.' and t.keytag == 12892 and t.algorithm == 5 and t.digesttype == 1 and t.digest == b'\x98!\x13\xd0\x8bLj\x1d\x9fj\xee\x1e"7\xae\xf6\x9f?\x97Y' + Test TXT RR @@ -118,5 +118,5 @@ t.rrname == 'isc.org.' and t.keytag == 12892 and t.algorithm == 5 and t.digestty t = DNSRR(type="TXT", rdata="test") = DNSRRR(), check parameters -t = DNSRR('\x04test\x00\x00\x10\x00\x01\x00\x00\x00\x00\x018\xffScapy is an interactive packet manipulation program that enables you to sniff, mangle, send network packets ; test equipments ; probe and discover networks ; quickly develop new protocols. It can easily handle most classical tasks like scanning, tracerout7ing, probing, unit tests, attacks or network discovery.') +t = DNSRR(b'\x04test\x00\x00\x10\x00\x01\x00\x00\x00\x00\x018\xffScapy is an interactive packet manipulation program that enables you to sniff, mangle, send network packets ; test equipments ; probe and discover networks ; quickly develop new protocols. It can easily handle most classical tasks like scanning, tracerout7ing, probing, unit tests, attacks or network discovery.') t.type == 16 and t.rdlen == 312 and t.rdata[:5] == "Scapy" and t.rdata[-10:] == "discovery." diff --git a/test/edns0.uts b/test/edns0.uts index f9589adbf10dd243538a1b13754b7bc833bf8fd0..0fcbca0626a0fea6517413224e721a4f2c06d503 100644 --- a/test/edns0.uts +++ b/test/edns0.uts @@ -7,55 +7,55 @@ = EDNS0TLV(), basic instanciation tlv = EDNS0TLV() -str(tlv) == '\x00\x00\x00\x00' +str(tlv) == b'\x00\x00\x00\x00' = EDNS0TLV(), check parameters tlv = EDNS0TLV(optcode=42, optlen=12, optdata="edns0tlv") -str(tlv) == '\x00*\x00\x0cedns0tlv' +str(tlv) == b'\x00*\x00\x0cedns0tlv' = EDNS0TLV(), check computed optlen tlv = EDNS0TLV(optdata="edns0tlv") -str(tlv) == '\x00\x00\x00\x08edns0tlv' +str(tlv) == b'\x00\x00\x00\x08edns0tlv' = EDNS0TLV(), dissection -tlv = EDNS0TLV('\x00*\x00\x08edns0tlv') +tlv = EDNS0TLV(b'\x00*\x00\x08edns0tlv') tlv.optcode == 42 and tlv.optlen == 8 and tlv.optdata == "edns0tlv" + Test OPT RR = DNSRROPT(), basic instanciation opt = DNSRROPT() -str(opt) == '\x00\x00)\x10\x00\x00\x00\x80\x00\x00\x00' +str(opt) == b'\x00\x00)\x10\x00\x00\x00\x80\x00\x00\x00' = DNSRROPT(), check parameters opt = DNSRROPT(rrname="rropt", type=42, rclass=123, extrcode=1, version=2, z=3, rdlen=4, rdata=[EDNS0TLV()]) -str(opt) == '\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x04\x00\x00\x00\x00' +str(opt) == b'\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x04\x00\x00\x00\x00' = DNSRROPT() & EDN0TLV(), check parameters opt = DNSRROPT(rrname="rropt", type=42, rclass=123, extrcode=1, version=2, z=3, rdlen=4, rdata=[EDNS0TLV(optcode=42, optlen=12, optdata="edns0tlv")]) -str(opt) == '\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x04\x00*\x00\x0cedns0tlv' +str(opt) == b'\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x04\x00*\x00\x0cedns0tlv' = DNSRROP(), dissection -opt = DNSRROPT('\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x0c\x00*\x00\x0cedns0tlv') +opt = DNSRROPT(b'\x05rropt\x00\x00*\x00{\x01\x02\x00\x03\x00\x0c\x00*\x00\x0cedns0tlv') opt.rrname == "rropt." and opt.rdlen == 12 and opt.rdata[0].optcode == 42 and opt.rdata[0].optdata == "edns0tlv" + Test EDNS-PING = EDNS-PING - basic instanciation -tlv = EDNS0TLV(optcode=5, optdata="\x00\x11\x22\x33") -str(tlv) == '\x00\x05\x00\x04\x00\x11"3' +tlv = EDNS0TLV(optcode=5, optdata=b"\x00\x11\x22\x33") +str(tlv) == b'\x00\x05\x00\x04\x00\x11"3' #= EDNS-PING - Live test #~ netaccess #* NB: 85.17.219.217 and www.edns-ping.org seem down -#r = sr1(IP(dst="85.17.219.217")/UDP()/DNS(qd=[DNSQR(qtype="A", qname="www.edns-ping.org.")], ar=[DNSRROPT(z=0, rdata=[EDNS0TLV(optcode="PING", optdata="\x00\x11\x22\x33")])]), timeout=1) +#r = sr1(IP(dst="85.17.219.217")/UDP()/DNS(qd=[DNSQR(qtype="A", qname="www.edns-ping.org.")], ar=[DNSRROPT(z=0, rdata=[EDNS0TLV(optcode="PING", optdata=b"\x00\x11\x22\x33")])]), timeout=1) #len(r.ar) and r.ar.rdata[0].optcode == 4 # XXX: should be 5 + Test DNS Name Server Identifier (NSID) Option = NSID- basic instanciation tlv = EDNS0TLV(optcode=2, optdata="") -str(tlv) == '\x00\x02\x00\x00' +str(tlv) == b'\x00\x02\x00\x00' = NSID - Live test ~ netaccess diff --git a/test/fields.uts b/test/fields.uts index 2c683f85cad881cbdd10dfd44b371ade811ccb2c..df9ba1b723cb39ec2ad9cc09860b8a12a90ceed4 100644 --- a/test/fields.uts +++ b/test/fields.uts @@ -7,12 +7,12 @@ #= Field class #~ core field #Field("foo", None, fmt="H").i2m(None,0xabcdef) -#assert( _ == "\xcd\xef" ) +#assert( _ == b"\xcd\xef" ) #Field("foo", None, fmt="<I").i2m(None,0x12cdef) -#assert( _ == "\xef\xcd\x12\x00" ) +#assert( _ == b"\xef\xcd\x12\x00" ) #Field("foo", None, fmt="B").addfield(None, "FOO", 0x12) -#assert( _ == "FOO\x12" ) -#Field("foo", None, fmt="I").getfield(None, "\x12\x34\x56\x78ABCD") +#assert( _ == b"FOO\x12" ) +#Field("foo", None, fmt="I").getfield(None, b"\x12\x34\x56\x78ABCD") #assert( _ == ("ABCD",0x12345678) ) # #= ConditionnalField class @@ -23,11 +23,11 @@ ~ core field m = MACField("foo", None) m.i2m(None, None) -assert( _ == "\x00\x00\x00\x00\x00\x00" ) -m.getfield(None, "\xc0\x01\xbe\xef\xba\xbeABCD") +assert( _ == b"\x00\x00\x00\x00\x00\x00" ) +m.getfield(None, b"\xc0\x01\xbe\xef\xba\xbeABCD") assert( _ == ("ABCD","c0:01:be:ef:ba:be") ) m.addfield(None, "FOO", "c0:01:be:ef:ba:be") -assert( _ == "FOO\xc0\x01\xbe\xef\xba\xbe" ) +assert( _ == b"FOO\xc0\x01\xbe\xef\xba\xbe" ) = SourceMACField, ARPSourceMACField conf.route.add(net="1.2.3.4/32", dev=conf.iface) @@ -39,15 +39,15 @@ conf.route.delt(net="1.2.3.4/32") ~ core field i = IPField("foo", None) i.i2m(None, "1.2.3.4") -assert( _ == "\x01\x02\x03\x04" ) +assert( _ == b"\x01\x02\x03\x04" ) i.i2m(None, "255.255.255.255") -assert( _ == "\xff\xff\xff\xff" ) -i.m2i(None, "\x01\x02\x03\x04") +assert( _ == b"\xff\xff\xff\xff" ) +i.m2i(None, b"\x01\x02\x03\x04") assert( _ == "1.2.3.4" ) -i.getfield(None, "\x01\x02\x03\x04ABCD") +i.getfield(None, b"\x01\x02\x03\x04ABCD") assert( _ == ("ABCD","1.2.3.4") ) i.addfield(None, "FOO", "1.2.3.4") -assert( _ == "FOO\x01\x02\x03\x04" ) +assert( _ == b"FOO\x01\x02\x03\x04" ) = SourceIPField ~ core field @@ -113,17 +113,17 @@ class TestFLenF(Packet): ~ field TestFLenF() str(_) -_ == "\x08default" +_ == b"\x08default" = Assembly of non empty packet ~ field TestFLenF(str="123") str(_) -_ == "\x04123" +_ == b"\x04123" = Disassembly ~ field -TestFLenF("\x04ABCDEFGHIJKL") +TestFLenF(b"\x04ABCDEFGHIJKL") _ _.len == 4 and _.str == "ABC" and Raw in _ @@ -137,16 +137,16 @@ class TestBFLenF(Packet): a=TestBFLenF() str(a) -assert( _ == "\x8f\xffdefault" ) +assert( _ == b"\x8f\xffdefault" ) a.str="" str(a) -assert( _ == "\x1f\xff" ) +assert( _ == b"\x1f\xff" ) -TestBFLenF("\x1f\xff@@") +TestBFLenF(b"\x1f\xff@@") assert( _.len == 1 and _.str == "" and Raw in _ and _[Raw].load == "@@" ) -TestBFLenF("\x6f\xffabcdeFGH") +TestBFLenF(b"\x6f\xffabcdeFGH") assert( _.len == 6 and _.str == "abcde" and Raw in _ and _[Raw].load == "FGH" ) @@ -180,8 +180,8 @@ _ == struct.pack("!BII", 2,7,65539) = Disassemble ~ field import struct -TestFLF("\x00\x11\x12") -assert(_.len == 0 and Raw in _ and _[Raw].load == "\x11\x12") +TestFLF(b"\x00\x11\x12") +assert(_.len == 0 and Raw in _ and _[Raw].load == b"\x11\x12") TestFLF(struct.pack("!BIII",3,1234,2345,12345678)) assert(_.len == 3 and _.lst == [1234,2345,12345678]) @@ -189,17 +189,17 @@ assert(_.len == 3 and _.lst == [1234,2345,12345678]) ~ field a = TestFLF(lst=[4]) str(a) -assert(_ == "\x01\x00\x00\x00\x04") +assert(_ == b"\x01\x00\x00\x00\x04") a.lst.append(1234) TestFLF(str(a)) a.show2() a.len=7 str(a) -assert(_ == "\x07\x00\x00\x00\x04\x00\x00\x04\xd2") +assert(_ == b"\x07\x00\x00\x00\x04\x00\x00\x04\xd2") a.len=2 a.lst=[1,2,3,4,5] TestFLF(str(a)) -assert(Raw in _ and _[Raw].load == '\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05') +assert(Raw in _ and _[Raw].load == b'\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x05') ############ @@ -217,14 +217,14 @@ class TestPLF(Packet): ~ field lengthfield x=TestPLF() str(x) -_ == "\x00\x00" +_ == b"\x00\x00" = Test the PacketListField assembly 2 ~ field lengthfield x=TestPLF() x.plist=[IP()/TCP(), IP()/UDP()] str(x) -_.startswith('\x00\x02E') +_.startswith(b'\x00\x02E') = Test disassembly ~ field lengthfield @@ -255,14 +255,14 @@ class TestPLF(Packet): ~ field lengthfield x=TestPLF() str(x) -_ == "\x00\x00" +_ == b"\x00\x00" = Test the PacketListField assembly 2 ~ field lengthfield x=TestPLF() x.plist=[IP()/TCP(), IP()/UDP()] str(x) -_.startswith('\x00\x02E') +_.startswith(b'\x00\x02E') = Test disassembly ~ field lengthfield @@ -293,11 +293,11 @@ class TestPLF2(Packet): a=TestPLF2() str(a) -assert( _ == "\x00\x02\x00\x00\x00\x00" ) +assert( _ == b"\x00\x02\x00\x00\x00\x00" ) a.plist=[TestPkt(),TestPkt(f1=100)] str(a) -assert(_ == '\x00\x04\x00\x00\x00\x03ABDdBD') +assert(_ == b'\x00\x04\x00\x00\x00\x03ABDdBD') a /= "123456" b = TestPLF2(str(a)) diff --git a/test/ipsec.uts b/test/ipsec.uts index c271cc8ee3ee1a1cb0f4f2d63be4dc8a96bb6c8a..4e9667c9518216a2b0ac1901f5f85965e184db35 100644 --- a/test/ipsec.uts +++ b/test/ipsec.uts @@ -538,7 +538,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -606,7 +606,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -674,7 +674,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -742,7 +742,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -810,7 +810,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -878,7 +878,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -951,7 +951,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -1023,7 +1023,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -1095,7 +1095,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -1167,7 +1167,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -1239,7 +1239,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -1311,7 +1311,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -2613,7 +2613,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: @@ -2879,7 +2879,7 @@ assert(e[ESP].spi == sa.spi) assert('testdata' in e[ESP].data) * simulate the alteration of the packet before decryption -e[ESP].data = e[ESP].data.replace('\x01', '\x21') +e[ESP].data = e[ESP].data.replace(b'\x01', b'\x21') * integrity verification should fail try: diff --git a/test/pptp.uts b/test/pptp.uts index 8aef367e53433efb5b0044fd0e221e7a78c0155d..8d353502b38f62e1d07ac41ff6a07464465c6c40 100644 --- a/test/pptp.uts +++ b/test/pptp.uts @@ -355,8 +355,8 @@ assert start_control_connection_pkt.framing_capabilities == 1 assert start_control_connection_pkt.bearer_capabilities == 2 assert start_control_connection_pkt.maximum_channels == 42 assert start_control_connection_pkt.firmware_revision == 47 -assert start_control_connection_pkt.host_name == 'test host name' + '\0' * (64-len('test host name')) -assert start_control_connection_pkt.vendor_string == 'test vendor string' + '\0' * (64-len('test vendor string')) +assert start_control_connection_pkt.host_name == 'test host name' + b'\0' * (64-len('test host name')) +assert start_control_connection_pkt.vendor_string == 'test vendor string' + b'\0' * (64-len('test vendor string')) = Test PPTP Start-Control-Connection-Reply ~ pptp @@ -383,8 +383,8 @@ assert start_control_connection_reply_pkt.result_code == 2 assert start_control_connection_reply_pkt.error_code == 1 assert start_control_connection_reply_pkt.framing_capabilities == 2 assert start_control_connection_reply_pkt.bearer_capabilities == 1 -assert start_control_connection_reply_pkt.host_name == 'linux' + '\0' * (64-len('linux')) -assert start_control_connection_reply_pkt.vendor_string == 'vendor' + '\0' * (64-len('vendor')) +assert start_control_connection_reply_pkt.host_name == 'linux' + b'\0' * (64-len('linux')) +assert start_control_connection_reply_pkt.vendor_string == 'vendor' + b'\0' * (64-len('vendor')) start_control_connection_request = PPTPStartControlConnectionRequest() @@ -491,8 +491,8 @@ assert outgoing_call_pkt.framing_type == 3 assert outgoing_call_pkt.pkt_window_size == 16 assert outgoing_call_pkt.pkt_proc_delay == 1 assert outgoing_call_pkt.phone_number_len == 9 -assert outgoing_call_pkt.phone_number == '123456789' + '\0' * (64-len('123456789')) -assert outgoing_call_pkt.subaddress == 'test' + '\0' * (64-len('test')) +assert outgoing_call_pkt.phone_number == '123456789' + b'\0' * (64-len('123456789')) +assert outgoing_call_pkt.subaddress == 'test' + b'\0' * (64-len('test')) = Test PPTP Outgoing-Call-Reply ~ pptp @@ -554,9 +554,9 @@ assert incoming_call_pkt.bearer_type == 2 assert incoming_call_pkt.channel_id == 12 assert incoming_call_pkt.dialed_number_len == 9 assert incoming_call_pkt.dialing_number_len == 10 -assert incoming_call_pkt.dialed_number == '123456789' + '\0' * (64-len('123456789')) -assert incoming_call_pkt.dialing_number == '0123456789' + '\0' * (64-len('0123456879')) -assert incoming_call_pkt.subaddress == 'test' + '\0' * (64-len('test')) +assert incoming_call_pkt.dialed_number == '123456789' + b'\0' * (64-len('123456789')) +assert incoming_call_pkt.dialing_number == '0123456789' + b'\0' * (64-len('0123456879')) +assert incoming_call_pkt.subaddress == 'test' + b'\0' * (64-len('test')) = Test PPTP Incoming-Call-Reply ~ pptp @@ -646,7 +646,7 @@ assert call_disconnect_notify_pkt.call_id == 4242 assert call_disconnect_notify_pkt.result_code == 3 assert call_disconnect_notify_pkt.error_code == 0 assert call_disconnect_notify_pkt.cause_code == 47 -assert call_disconnect_notify_pkt.call_statistic == 'some description' + '\0' * (128-len('some description')) +assert call_disconnect_notify_pkt.call_statistic == 'some description' + b'\0' * (128-len('some description')) = Test PPTP WAN-Error-Notify ~ pptp diff --git a/test/regression.uts b/test/regression.uts index e5bb842efd3756dfaec3b218d1475c5d1e71a61f..5bc959b4f3228b65b8acf3e33b7f379188f056ff 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -68,11 +68,11 @@ if len(routes6): if WINDOWS: route_add_loopback(ipv6=True, iflist=iflist) if iflist == [LOOPBACK_NAME]: - len(routes6) == 1 + len(routes6) == 1 elif len(iflist) >= 2: - len(routes6) >= 3 + len(routes6) >= 3 else: - False + False else: # IPv6 seems disabled. Force a route to ::1 conf.route6.routes.append(("::1", 128, "::", LOOPBACK_NAME, ["::1"])) @@ -83,8 +83,8 @@ else: if len(routes6): assert(len(filter(lambda r: r[0] == "::1" and r[-1] == ["::1"], routes6)) >= 1) if iflist >= 2: - assert(len(filter(lambda r: r[0] == "fe80::" and r[1] == 64, routes6)) >= 1) - len(filter(lambda r: in6_islladdr(r[0]) and r[1] == 128 and r[-1] == ["::1"], routes6)) >= 1 + assert(len(filter(lambda r: r[0] == "fe80::" and r[1] == 64, routes6)) >= 1) + len(filter(lambda r: in6_islladdr(r[0]) and r[1] == 128 and r[-1] == ["::1"], routes6)) >= 1 else: True @@ -184,15 +184,15 @@ conf.temp_files.pop() get_temp_file(True).startswith("/tmp/scapy") and len(conf.temp_files) == 0 -sane("A\x00\xFFB") == "A..B" +sane(b"A\x00\xFFB") == "A..B" linehexdump(Ether(), dump=True) == "FFFFFFFFFFFF0242D077E8129000 .......B.w...." chexdump(Ether(), dump=True) == "0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x42, 0xd0, 0x77, 0xe8, 0x12, 0x90, 0x00" -hexstr("A\x00\xFFB") == "41 00 ff 42 A..B" +hexstr(b"A\x00\xFFB") == "41 00 ff 42 A..B" -fletcher16_checksum("\x28\x07") == 22319 +fletcher16_checksum(b"\x28\x07") == 22319 tex_escape("$#_") == "\\$\\#\\_" @@ -399,7 +399,7 @@ a = IPv3() a.version, a.ttl assert(_ == (3,32)) str(a) -assert(_ == '5\x00\x00\x14\x00\x01\x00\x00 \x00\xac\xe7\x7f\x00\x00\x01\x7f\x00\x00\x01') +assert(_ == b'5\x00\x00\x14\x00\x01\x00\x00 \x00\xac\xe7\x7f\x00\x00\x01\x7f\x00\x00\x01') ############ @@ -421,7 +421,7 @@ _.res2 == 12345 = ISAKMP assembly ~ ISAKMP hexdump(p) -str(p) == "E\x00\x00\x96\x00\x01\x00\x00@\x11\xa7\x9f\xc0\xa8\x08\x0e\n\x00\x00\x01\x01\xf4\x01\xf4\x00\x82\xbf\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00z\x00\x00\x00^\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00R\x01\x01\x00\x00\x03\x00\x00'\x00\x01\x00\x00\x80\x01\x00\x07\x80\x02\x00\x01\x80\x03\x00\x01\x80\x04\x00\x05\x80\x0e\x01\x00\x80\x0b\x00\x01\x00\x0c\x00\x03\x01Q\x80\x00\x00\x00#\x00\x0109\x80\x01\x00\x05\x80\x02\x00\x02\x80\x03\x00\x01\x80\x04\x00\x02\x80\x0b\x00\x01\x00\x0c\x00\x03\x01Q\x80" +str(p) == b"E\x00\x00\x96\x00\x01\x00\x00@\x11\xa7\x9f\xc0\xa8\x08\x0e\n\x00\x00\x01\x01\xf4\x01\xf4\x00\x82\xbf\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00z\x00\x00\x00^\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00R\x01\x01\x00\x00\x03\x00\x00'\x00\x01\x00\x00\x80\x01\x00\x07\x80\x02\x00\x01\x80\x03\x00\x01\x80\x04\x00\x05\x80\x0e\x01\x00\x80\x0b\x00\x01\x00\x0c\x00\x03\x01Q\x80\x00\x00\x00#\x00\x0109\x80\x01\x00\x05\x80\x02\x00\x02\x80\x03\x00\x01\x80\x04\x00\x02\x80\x0b\x00\x01\x00\x0c\x00\x03\x01Q\x80" = ISAKMP disassembly @@ -438,7 +438,7 @@ _.res2 == 12345 = TFTP Options x=IP()/UDP(sport=12345)/TFTP()/TFTP_RRQ(filename="fname")/TFTP_Options(options=[TFTP_Option(oname="blksize", value="8192"),TFTP_Option(oname="other", value="othervalue")]) -assert( str(x) == 'E\x00\x00H\x00\x01\x00\x00@\x11|\xa2\x7f\x00\x00\x01\x7f\x00\x00\x0109\x00E\x004B6\x00\x01fname\x00octet\x00blksize\x008192\x00other\x00othervalue\x00' ) +assert( str(x) == b'E\x00\x00H\x00\x01\x00\x00@\x11|\xa2\x7f\x00\x00\x01\x7f\x00\x00\x0109\x00E\x004B6\x00\x01fname\x00octet\x00blksize\x008192\x00other\x00othervalue\x00' ) y=IP(str(x)) y[TFTP_Option].oname y[TFTP_Option:2].oname @@ -454,7 +454,7 @@ assert(len(y[TFTP_Options].options) == 2 and y[TFTP_Option].oname == "blksize") ~ wifi crypto Dot11 LLC SNAP IP TCP conf.wepkey = "Fobar" str(Dot11WEP()/LLC()/SNAP()/IP()/TCP(seq=12345678)) -assert(_ == '\x00\x00\x00\x00\xe3OjYLw\xc3x_%\xd0\xcf\xdeu-\xc3pH#\x1eK\xae\xf5\xde\xe7\xb8\x1d,\xa1\xfe\xe83\xca\xe1\xfe\xbd\xfe\xec\x00)T`\xde.\x93Td\x95C\x0f\x07\xdd') +assert(_ == b'\x00\x00\x00\x00\xe3OjYLw\xc3x_%\xd0\xcf\xdeu-\xc3pH#\x1eK\xae\xf5\xde\xe7\xb8\x1d,\xa1\xfe\xe83\xca\xe1\xfe\xbd\xfe\xec\x00)T`\xde.\x93Td\x95C\x0f\x07\xdd') Dot11WEP(_) assert(TCP in _ and _[TCP].seq == 12345678) @@ -466,14 +466,14 @@ assert(TCP in _ and _[TCP].seq == 12345678) = SNMP assembling ~ SNMP ASN1 str(SNMP()) -assert(_ == '0\x18\x02\x01\x01\x04\x06public\xa0\x0b\x02\x01\x00\x02\x01\x00\x02\x01\x000\x00') +assert(_ == b'0\x18\x02\x01\x01\x04\x06public\xa0\x0b\x02\x01\x00\x02\x01\x00\x02\x01\x000\x00') SNMP(version="v2c", community="ABC", PDU=SNMPbulk(id=4,varbindlist=[SNMPvarbind(oid="1.2.3.4",value=ASN1_INTEGER(7)),SNMPvarbind(oid="4.3.2.1.2.3",value=ASN1_IA5_STRING("testing123"))])) str(_) -assert(_ == '05\x02\x01\x01\x04\x03ABC\xa5+\x02\x01\x04\x02\x01\x00\x02\x01\x000 0\x08\x06\x03*\x03\x04\x02\x01\x070\x14\x06\x06\x81#\x02\x01\x02\x03\x16\ntesting123') +assert(_ == b'05\x02\x01\x01\x04\x03ABC\xa5+\x02\x01\x04\x02\x01\x00\x02\x01\x000 0\x08\x06\x03*\x03\x04\x02\x01\x070\x14\x06\x06\x81#\x02\x01\x02\x03\x16\ntesting123') = SNMP disassembling ~ SNMP ASN1 -x=SNMP('0y\x02\x01\x00\x04\x06public\xa2l\x02\x01)\x02\x01\x00\x02\x01\x000a0!\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x07\n\x86\xde\xb78\x04\x0b172.31.19.20#\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x07\n\x86\xde\xb76\x04\r255.255.255.00\x17\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x05\n\x86\xde\xb9`\x02\x01\x01') +x=SNMP(b'0y\x02\x01\x00\x04\x06public\xa2l\x02\x01)\x02\x01\x00\x02\x01\x000a0!\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x07\n\x86\xde\xb78\x04\x0b172.31.19.20#\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x07\n\x86\xde\xb76\x04\r255.255.255.00\x17\x06\x12+\x06\x01\x04\x01\x81}\x08@\x04\x02\x01\x05\n\x86\xde\xb9`\x02\x01\x01') x.show() assert(x.community=="public" and x.version == 0) assert(x.PDU.id == 41 and len(x.PDU.varbindlist) == 3) @@ -609,7 +609,7 @@ del(dns_ans2[IP].len) del(dns_ans2[IP].chksum) del(dns_ans2[UDP].len) del(dns_ans2[UDP].chksum) -assert("\x03www\x06secdev\x03org\x00" in str(dns_ans2)) +assert(b"\x03www\x06secdev\x03org\x00" in str(dns_ans2)) assert(DNS in IP(str(dns_ans2))) = Arping @@ -701,7 +701,7 @@ class ATMT1(Automaton): self.init = init @ATMT.state(initial=1) def BEGIN(self): - raise self.MAIN(self.init) + raise self.MAIN(self.init) @ATMT.state() def MAIN(self, s): return s @@ -1022,21 +1022,21 @@ assert( _ == "Venus" ) = IP options individual assembly ~ IP options str(IPOption()) -assert(_ == '\x00\x02') +assert(_ == b'\x00\x02') str(IPOption_NOP()) -assert(_ == '\x01') +assert(_ == b'\x01') str(IPOption_EOL()) -assert(_ == '\x00') +assert(_ == b'\x00') str(IPOption_LSRR(routers=["1.2.3.4","5.6.7.8"])) -assert(_ == '\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08') +assert(_ == b'\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08') = IP options individual dissection ~ IP options -IPOption("\x00") +IPOption(b"\x00") assert(_.option == 0 and isinstance(_, IPOption_EOL)) -IPOption("\x01") +IPOption(b"\x01") assert(_.option == 1 and isinstance(_, IPOption_NOP)) -lsrr='\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08' +lsrr=b'\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08' p=IPOption_LSRR(lsrr) p q=IPOption(lsrr) @@ -1047,7 +1047,7 @@ assert(p == q) ~ IP options p = IP(src="9.10.11.12",dst="13.14.15.16",options=IPOption_SDBM(addresses=["1.2.3.4","5.6.7.8"]))/TCP() str(p) -assert(_ == 'H\x00\x004\x00\x01\x00\x00@\x06\xa2q\t\n\x0b\x0c\r\x0e\x0f\x10\x95\n\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00_K\x00\x00') +assert(_ == b'H\x00\x004\x00\x01\x00\x00@\x06\xa2q\t\n\x0b\x0c\r\x0e\x0f\x10\x95\n\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00_K\x00\x00') q=IP(_) q assert( isinstance(q.options[0],IPOption_SDBM) ) @@ -1056,7 +1056,7 @@ p.options[0].addresses[0] = '5.6.7.8' assert( IP(str(p)).options[0].addresses[0] == '5.6.7.8' ) IP(src="9.10.11.12", dst="13.14.15.16", options=[IPOption_NOP(),IPOption_LSRR(routers=["1.2.3.4","5.6.7.8"]),IPOption_Security(transmission_control_code="XYZ")])/TCP() str(_) -assert(_ == 'K\x00\x00@\x00\x01\x00\x00@\x06\xf3\x83\t\n\x0b\x0c\r\x0e\x0f\x10\x01\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08\x82\x0b\x00\x00\x00\x00\x00\x00XYZ\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00_K\x00\x00') +assert(_ == b'K\x00\x00@\x00\x01\x00\x00@\x06\xf3\x83\t\n\x0b\x0c\r\x0e\x0f\x10\x01\x83\x0b\x04\x01\x02\x03\x04\x05\x06\x07\x08\x82\x0b\x00\x00\x00\x00\x00\x00XYZ\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00_K\x00\x00') IP(_) q=_ assert(q[IPOption_LSRR].get_current_router() == "1.2.3.4") @@ -1073,7 +1073,7 @@ assert(q[TCP].flags == 2) HDLC()/PPP()/PPP_IPCP() str(_) s=_ -assert(s == '\xff\x03\x80!\x01\x00\x00\x04') +assert(s == b'\xff\x03\x80!\x01\x00\x00\x04') PPP(s) p=_ assert(HDLC in p) @@ -1087,14 +1087,14 @@ assert(q[PPP].proto==0x8021) = PPP IPCP ~ ppp ipcp -PPP('\x80!\x01\x01\x00\x10\x03\x06\xc0\xa8\x01\x01\x02\x06\x00-\x0f\x01') +PPP(b'\x80!\x01\x01\x00\x10\x03\x06\xc0\xa8\x01\x01\x02\x06\x00-\x0f\x01') p=_ assert(p[PPP_IPCP].code == 1) assert(p[PPP_IPCP_Option_IPAddress].data=="192.168.1.1") -assert(p[PPP_IPCP_Option].data == '\x00-\x0f\x01') +assert(p[PPP_IPCP_Option].data == b'\x00-\x0f\x01') p=PPP()/PPP_IPCP(options=[PPP_IPCP_Option_DNS1(data="1.2.3.4"),PPP_IPCP_Option_DNS2(data="5.6.7.8"),PPP_IPCP_Option_NBNS2(data="9.10.11.12")]) str(p) -assert(_ == '\x80!\x01\x00\x00\x16\x81\x06\x01\x02\x03\x04\x83\x06\x05\x06\x07\x08\x84\x06\t\n\x0b\x0c') +assert(_ == b'\x80!\x01\x00\x00\x16\x81\x06\x01\x02\x03\x04\x83\x06\x05\x06\x07\x08\x84\x06\t\n\x0b\x0c') PPP(_) q=_ assert(str(p) == str(q)) @@ -1102,7 +1102,7 @@ assert(PPP(str(q))==q) PPP()/PPP_IPCP(options=[PPP_IPCP_Option_DNS1(data="1.2.3.4"),PPP_IPCP_Option_DNS2(data="5.6.7.8"),PPP_IPCP_Option(type=123,data="ABCDEFG"),PPP_IPCP_Option_NBNS2(data="9.10.11.12")]) p=_ str(p) -assert(_ == '\x80!\x01\x00\x00\x1f\x81\x06\x01\x02\x03\x04\x83\x06\x05\x06\x07\x08{\tABCDEFG\x84\x06\t\n\x0b\x0c') +assert(_ == b'\x80!\x01\x00\x00\x1f\x81\x06\x01\x02\x03\x04\x83\x06\x05\x06\x07\x08{\tABCDEFG\x84\x06\t\n\x0b\x0c') PPP(_) q=_ assert( q[PPP_IPCP_Option].type == 123 ) @@ -1116,14 +1116,14 @@ assert( q[PPP_IPCP_Option_NBNS2].data == '9.10.11.12' ) PPP()/PPP_ECP(options=[PPP_ECP_Option_OUI(oui="XYZ")]) p=_ str(p) -assert(_ == '\x80S\x01\x00\x00\n\x00\x06XYZ\x00') +assert(_ == b'\x80S\x01\x00\x00\n\x00\x06XYZ\x00') PPP(_) q=_ assert( str(p)==str(q) ) PPP()/PPP_ECP(options=[PPP_ECP_Option_OUI(oui="XYZ"),PPP_ECP_Option(type=1,data="ABCDEFG")]) p=_ str(p) -assert(_ == '\x80S\x01\x00\x00\x13\x00\x06XYZ\x00\x01\tABCDEFG') +assert(_ == b'\x80S\x01\x00\x00\x13\x00\x06XYZ\x00\x01\tABCDEFG') PPP(_) q=_ assert( str(p) == str(q) ) @@ -1139,28 +1139,28 @@ assert( q[PPP_ECP_Option].data == "ABCDEFG" ) a=IPv6() = IPv6 Class basic build (default values) -str(IPv6()) == '`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(IPv6()) == b'`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = IPv6 Class basic dissection (default values) a=IPv6(str(IPv6())) a.version == 6 and a.tc == 0 and a.fl == 0 and a.plen == 0 and a.nh == 59 and a.hlim ==64 and a.src == "::1" and a.dst == "::1" = IPv6 Class with basic TCP stacked - build -str(IPv6()/TCP()) == '`\x00\x00\x00\x00\x14\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00' +str(IPv6()/TCP()) == b'`\x00\x00\x00\x00\x14\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00' = IPv6 Class with basic TCP stacked - dissection a=IPv6(str(IPv6()/TCP())) a.nh == 6 and a.plen == 20 and isinstance(a.payload, TCP) and a.payload.chksum == 0x8f7d = IPv6 Class with TCP and TCP data - build -str(IPv6()/TCP()/Raw(load="somedata")) == '`\x00\x00\x00\x00\x1c\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xd5\xdd\x00\x00somedata' +str(IPv6()/TCP()/Raw(load="somedata")) == b'`\x00\x00\x00\x00\x1c\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xd5\xdd\x00\x00somedata' = IPv6 Class with TCP and TCP data - dissection a=IPv6(str(IPv6()/TCP()/Raw(load="somedata"))) a.nh == 6 and a.plen == 28 and isinstance(a.payload, TCP) and a.payload.chksum == 0xd5dd and isinstance(a.payload.payload, Raw) and a[Raw].load == "somedata" = IPv6 Class binding with Ethernet - build -str(Ether(src="00:00:00:00:00:00", dst="ff:ff:ff:ff:ff:ff")/IPv6()/TCP()) == '\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x86\xdd`\x00\x00\x00\x00\x14\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00' +str(Ether(src="00:00:00:00:00:00", dst="ff:ff:ff:ff:ff:ff")/IPv6()/TCP()) == b'\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x86\xdd`\x00\x00\x00\x00\x14\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00' = IPv6 Class binding with Ethernet - dissection a=Ether(str(Ether()/IPv6()/TCP())) @@ -1170,25 +1170,25 @@ a.type == 0x86dd ########### IPv6ExtHdrRouting Class ########################### = IPv6ExtHdrRouting Class - No address - build -str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=[])/TCP(dport=80)) =='`\x00\x00\x00\x00\x1c+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x00\x00\x00\x00\x00\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa5&\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=[])/TCP(dport=80)) ==b'`\x00\x00\x00\x00\x1c+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x00\x00\x00\x00\x00\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa5&\x00\x00' = IPv6ExtHdrRouting Class - One address - build -str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2022::deca"])/TCP(dport=80)) == '`\x00\x00\x00\x00,+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x02\x00\x01\x00\x00\x00\x00 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2022::deca"])/TCP(dport=80)) == b'`\x00\x00\x00\x00,+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x02\x00\x01\x00\x00\x00\x00 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' = IPv6ExtHdrRouting Class - Multiple Addresses - build -str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"])/TCP(dport=80)) == '`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x02\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"])/TCP(dport=80)) == b'`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x02\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' = IPv6ExtHdrRouting Class - Specific segleft (2->1) - build -str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"], segleft=1)/TCP(dport=80)) == '`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x01\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"], segleft=1)/TCP(dport=80)) == b'`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x01\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91\x7f\x00\x00' = IPv6ExtHdrRouting Class - Specific segleft (2->0) - build -str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"], segleft=0)/TCP(dport=80)) == '`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa5&\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/IPv6ExtHdrRouting(addresses=["2001::deca", "2022::deca"], segleft=0)/TCP(dport=80)) == b'`\x00\x00\x00\x00<+@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x06\x04\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xa5&\x00\x00' ########### IPv6ExtHdrSegmentRouting Class ########################### = IPv6ExtHdrSegmentRouting Class - default - build & dissect s = str(IPv6()/IPv6ExtHdrSegmentRouting()/UDP()) -assert(s == '`\x00\x00\x00\x00 +@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x02\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x005\x005\x00\x08\xffr') +assert(s == b'`\x00\x00\x00\x00 +@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x02\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x005\x005\x00\x08\xffr') p = IPv6(s) assert(UDP in p and IPv6ExtHdrSegmentRouting in p) @@ -1197,7 +1197,7 @@ assert(len(p[IPv6ExtHdrSegmentRouting].addresses) == 1 and len(p[IPv6ExtHdrSegme = IPv6ExtHdrSegmentRouting Class - empty lists - build & dissect s = str(IPv6()/IPv6ExtHdrSegmentRouting(addresses=[], tlv_objects=[])/UDP()) -assert(s == '`\x00\x00\x00\x00\x10+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x00\x04\x00\x00\x00\x00\x00\x005\x005\x00\x08\xffr') +assert(s == b'`\x00\x00\x00\x00\x10+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x00\x04\x00\x00\x00\x00\x00\x005\x005\x00\x08\xffr') p = IPv6(s) assert(UDP in p and IPv6ExtHdrSegmentRouting in p) @@ -1206,7 +1206,7 @@ assert(len(p[IPv6ExtHdrSegmentRouting].addresses) == 0 and len(p[IPv6ExtHdrSegme = IPv6ExtHdrSegmentRouting Class - addresses list - build & dissect s = str(IPv6()/IPv6ExtHdrSegmentRouting(addresses=["::1", "::2", "::3"])/UDP()) -assert(s == '`\x00\x00\x00\x00@+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x06\x04\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x005\x005\x00\x08\xffr') +assert(s == b'`\x00\x00\x00\x00@+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x11\x06\x04\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x005\x005\x00\x08\xffr') p = IPv6(s) assert(UDP in p and IPv6ExtHdrSegmentRouting in p) @@ -1215,7 +1215,7 @@ assert(len(p[IPv6ExtHdrSegmentRouting].addresses) == 3 and len(p[IPv6ExtHdrSegme = IPv6ExtHdrSegmentRouting Class - TLVs list - build & dissect s = str(IPv6()/IPv6ExtHdrSegmentRouting(addresses=[], tlv_objects=[IPv6ExtHdrSegmentRoutingTLV()])/TCP()) -assert(s == '`\x00\x00\x00\x00$+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x06\x01\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x02\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00') +assert(s == b'`\x00\x00\x00\x00$+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x06\x01\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x02\x00\x00\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x8f}\x00\x00') p = IPv6(s) assert(TCP in p and IPv6ExtHdrSegmentRouting in p) @@ -1225,7 +1225,7 @@ assert(isinstance(p[IPv6ExtHdrSegmentRouting].tlv_objects[1], IPv6ExtHdrSegmentR = IPv6ExtHdrSegmentRouting Class - both lists - build & dissect s = str(IPv6()/IPv6ExtHdrSegmentRouting(addresses=["::1", "::2", "::3"], tlv_objects=[IPv6ExtHdrSegmentRoutingTLVIngressNode(),IPv6ExtHdrSegmentRoutingTLVEgressNode()])/ICMPv6EchoRequest()) -assert(s == '`\x00\x00\x00\x00h+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01:\x0b\x04\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x01\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x80\x00\x7f\xbb\x00\x00\x00\x00') +assert(s == b'`\x00\x00\x00\x00h+@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01:\x0b\x04\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x01\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x80\x00\x7f\xbb\x00\x00\x00\x00') p = IPv6(s) assert(ICMPv6EchoRequest in p and IPv6ExtHdrSegmentRouting in p) @@ -1280,7 +1280,7 @@ d = in6_getLinkScopedMcastAddr(addr="FE80::", scope=3) a == 'ff30:ff::' and b == 'ff31:ff::' and c == 'ff32:ff::' and d is None = in6_getLinkScopedMcastAddr() : grpid in different formats -a = in6_getLinkScopedMcastAddr(addr="FE80::A12:34FF:FE56:7890", grpid="\x12\x34\x56\x78") +a = in6_getLinkScopedMcastAddr(addr="FE80::A12:34FF:FE56:7890", grpid=b"\x12\x34\x56\x78") b = in6_getLinkScopedMcastAddr(addr="FE80::A12:34FF:FE56:7890", grpid="12345678") c = in6_getLinkScopedMcastAddr(addr="FE80::A12:34FF:FE56:7890", grpid=305419896) a == b and b == c @@ -1420,13 +1420,13 @@ in6_getAddrType("1000::1") == (IPV6_ADDR_GLOBAL | IPV6_ADDR_UNICAST) ########### ICMPv6DestUnreach Class ################################# = ICMPv6DestUnreach Class - Basic Build (no argument) -str(ICMPv6DestUnreach()) == '\x01\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6DestUnreach()) == b'\x01\x00\x00\x00\x00\x00\x00\x00' = ICMPv6DestUnreach Class - Basic Build over IPv6 (for cksum and overload) -str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6DestUnreach()) == '`\x00\x00\x00\x00\x08:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x01\x00\x14e\x00\x00\x00\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6DestUnreach()) == b'`\x00\x00\x00\x00\x08:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x01\x00\x14e\x00\x00\x00\x00' = ICMPv6DestUnreach Class - Basic Build over IPv6 with some payload -str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6DestUnreach()/IPv6(src="2047::cafe", dst="2048::deca")) == '`\x00\x00\x00\x000:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x01\x00\x8e\xa3\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@ G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca' +str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6DestUnreach()/IPv6(src="2047::cafe", dst="2048::deca")) == b'`\x00\x00\x00\x000:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x01\x00\x8e\xa3\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@ G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca' = ICMPv6DestUnreach Class - Dissection with default values and some payload a = IPv6(str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6DestUnreach()/IPv6(src="2047::cafe", dst="2048::deca"))) @@ -1445,13 +1445,13 @@ a[ICMPv6DestUnreach][TCPerror].chksum == b.chksum ########### ICMPv6PacketTooBig Class ################################ = ICMPv6PacketTooBig Class - Basic Build (no argument) -str(ICMPv6PacketTooBig()) == '\x02\x00\x00\x00\x00\x00\x05\x00' +str(ICMPv6PacketTooBig()) == b'\x02\x00\x00\x00\x00\x00\x05\x00' = ICMPv6PacketTooBig Class - Basic Build over IPv6 (for cksum and overload) -str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6PacketTooBig()) == '`\x00\x00\x00\x00\x08:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x02\x00\x0ee\x00\x00\x05\x00' +str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6PacketTooBig()) == b'`\x00\x00\x00\x00\x08:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x02\x00\x0ee\x00\x00\x05\x00' = ICMPv6PacketTooBig Class - Basic Build over IPv6 with some payload -str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6PacketTooBig()/IPv6(src="2047::cafe", dst="2048::deca")) == '`\x00\x00\x00\x000:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x02\x00\x88\xa3\x00\x00\x05\x00`\x00\x00\x00\x00\x00;@ G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca' +str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6PacketTooBig()/IPv6(src="2047::cafe", dst="2048::deca")) == b'`\x00\x00\x00\x000:@ H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x02\x00\x88\xa3\x00\x00\x05\x00`\x00\x00\x00\x00\x00;@ G\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe H\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca' = ICMPv6PacketTooBig Class - Dissection with default values and some payload a = IPv6(str(IPv6(src="2048::deca", dst="2047::cafe")/ICMPv6PacketTooBig()/IPv6(src="2047::cafe", dst="2048::deca"))) @@ -1480,24 +1480,24 @@ a[ICMPv6PacketTooBig][TCPerror].chksum == b.chksum + Test ICMPv6EchoRequest Class = ICMPv6EchoRequest - Basic Instantiation -str(ICMPv6EchoRequest()) == '\x80\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6EchoRequest()) == b'\x80\x00\x00\x00\x00\x00\x00\x00' = ICMPv6EchoRequest - Instantiation with specific values -str(ICMPv6EchoRequest(code=0xff, cksum=0x1111, id=0x2222, seq=0x3333, data="thisissomestring")) == '\x80\xff\x11\x11""33thisissomestring' +str(ICMPv6EchoRequest(code=0xff, cksum=0x1111, id=0x2222, seq=0x3333, data="thisissomestring")) == b'\x80\xff\x11\x11""33thisissomestring' = ICMPv6EchoRequest - Basic dissection -a=ICMPv6EchoRequest('\x80\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6EchoRequest(b'\x80\x00\x00\x00\x00\x00\x00\x00') a.type == 128 and a.code == 0 and a.cksum == 0 and a.id == 0 and a.seq == 0 and a.data == "" = ICMPv6EchoRequest - Dissection with specific values -a=ICMPv6EchoRequest('\x80\xff\x11\x11""33thisissomestring') +a=ICMPv6EchoRequest(b'\x80\xff\x11\x11""33thisissomestring') a.type == 128 and a.code == 0xff and a.cksum == 0x1111 and a.id == 0x2222 and a.seq == 0x3333 and a.data == "thisissomestring" = ICMPv6EchoRequest - Automatic checksum computation and field overloading (build) -str(IPv6(dst="2001::cafe", src="2001::deca", hlim=64)/ICMPv6EchoRequest()) == '`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00' +str(IPv6(dst="2001::cafe", src="2001::deca", hlim=64)/ICMPv6EchoRequest()) == b'`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00' = ICMPv6EchoRequest - Automatic checksum computation and field overloading (dissection) -a=IPv6('`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00') isinstance(a, IPv6) and a.nh == 58 and isinstance(a.payload, ICMPv6EchoRequest) and a.payload.cksum == 0x95f1 @@ -1506,24 +1506,24 @@ isinstance(a, IPv6) and a.nh == 58 and isinstance(a.payload, ICMPv6EchoRequest) + Test ICMPv6EchoReply Class = ICMPv6EchoReply - Basic Instantiation -str(ICMPv6EchoReply()) == '\x81\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6EchoReply()) == b'\x81\x00\x00\x00\x00\x00\x00\x00' = ICMPv6EchoReply - Instantiation with specific values -str(ICMPv6EchoReply(code=0xff, cksum=0x1111, id=0x2222, seq=0x3333, data="thisissomestring")) == '\x81\xff\x11\x11""33thisissomestring' +str(ICMPv6EchoReply(code=0xff, cksum=0x1111, id=0x2222, seq=0x3333, data="thisissomestring")) == b'\x81\xff\x11\x11""33thisissomestring' = ICMPv6EchoReply - Basic dissection -a=ICMPv6EchoReply('\x80\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6EchoReply(b'\x80\x00\x00\x00\x00\x00\x00\x00') a.type == 128 and a.code == 0 and a.cksum == 0 and a.id == 0 and a.seq == 0 and a.data == "" = ICMPv6EchoReply - Dissection with specific values -a=ICMPv6EchoReply('\x80\xff\x11\x11""33thisissomestring') +a=ICMPv6EchoReply(b'\x80\xff\x11\x11""33thisissomestring') a.type == 128 and a.code == 0xff and a.cksum == 0x1111 and a.id == 0x2222 and a.seq == 0x3333 and a.data == "thisissomestring" = ICMPv6EchoReply - Automatic checksum computation and field overloading (build) -str(IPv6(dst="2001::cafe", src="2001::deca", hlim=64)/ICMPv6EchoReply()) == '`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x81\x00\x94\xf1\x00\x00\x00\x00' +str(IPv6(dst="2001::cafe", src="2001::deca", hlim=64)/ICMPv6EchoReply()) == b'`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x81\x00\x94\xf1\x00\x00\x00\x00' = ICMPv6EchoReply - Automatic checksum computation and field overloading (dissection) -a=IPv6('`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x08:@ \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xca \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe\x80\x00\x95\xf1\x00\x00\x00\x00') isinstance(a, IPv6) and a.nh == 58 and isinstance(a.payload, ICMPv6EchoRequest) and a.payload.cksum == 0x95f1 ########### ICMPv6EchoReply/Request answers() and hashret() ######### @@ -1563,10 +1563,10 @@ a=IPv6(src="2048::cafe", dst="2047::deca")/ICMPv6EchoRequest(id=0x6666, seq=0x77 ########### ICMPv6MRD* Classes ###################################### = ICMPv6MRD_Advertisement - Basic instantiation -str(ICMPv6MRD_Advertisement()) == '\x97\x14\x00\x00\x00\x00\x00\x00' +str(ICMPv6MRD_Advertisement()) == b'\x97\x14\x00\x00\x00\x00\x00\x00' = ICMPv6MRD_Advertisement - Instantiation with specific values -str(ICMPv6MRD_Advertisement(advinter=0xdd, queryint=0xeeee, robustness=0xffff)) == '\x97\xdd\x00\x00\xee\xee\xff\xff' +str(ICMPv6MRD_Advertisement(advinter=0xdd, queryint=0xeeee, robustness=0xffff)) == b'\x97\xdd\x00\x00\xee\xee\xff\xff' = ICMPv6MRD_Advertisement - Basic Dissection and overloading mechanisms a=Ether(str(Ether()/IPv6()/ICMPv6MRD_Advertisement())) @@ -1574,10 +1574,10 @@ a.dst == "33:33:00:00:00:02" and IPv6 in a and a[IPv6].plen == 8 and a[IPv6].nh = ICMPv6MRD_Solicitation - Basic dissection -str(ICMPv6MRD_Solicitation()) == '\x98\x00\x00\x00' +str(ICMPv6MRD_Solicitation()) == b'\x98\x00\x00\x00' = ICMPv6MRD_Solicitation - Instantiation with specific values -str(ICMPv6MRD_Solicitation(res=0xbb)) == '\x98\xbb\x00\x00' +str(ICMPv6MRD_Solicitation(res=0xbb)) == b'\x98\xbb\x00\x00' = ICMPv6MRD_Solicitation - Basic Dissection and overloading mechanisms a=Ether(str(Ether()/IPv6()/ICMPv6MRD_Solicitation())) @@ -1585,10 +1585,10 @@ a.dst == "33:33:00:00:00:02" and IPv6 in a and a[IPv6].plen == 4 and a[IPv6].nh = ICMPv6MRD_Termination Basic instantiation -str(ICMPv6MRD_Termination()) == '\x99\x00\x00\x00' +str(ICMPv6MRD_Termination()) == b'\x99\x00\x00\x00' = ICMPv6MRD_Termination - Instantiation with specific values -str(ICMPv6MRD_Termination(res=0xbb)) == '\x99\xbb\x00\x00' +str(ICMPv6MRD_Termination(res=0xbb)) == b'\x99\xbb\x00\x00' = ICMPv6MRD_Termination - Basic Dissection and overloading mechanisms a=Ether(str(Ether()/IPv6()/ICMPv6MRD_Termination())) @@ -1600,20 +1600,20 @@ a.dst == "33:33:00:00:00:6a" and IPv6 in a and a[IPv6].plen == 4 and a[IPv6].nh + Test HBHOptUnknown Class = HBHOptUnknown - Basic Instantiation -str(HBHOptUnknown()) == '\x01\x00' +str(HBHOptUnknown()) == b'\x01\x00' = HBHOptUnknown - Basic Dissection -a=HBHOptUnknown('\x01\x00') +a=HBHOptUnknown(b'\x01\x00') a.otype == 0x01 and a.optlen == 0 and a.optdata == "" = HBHOptUnknown - Automatic optlen computation -str(HBHOptUnknown(optdata="B"*10)) == '\x01\nBBBBBBBBBB' +str(HBHOptUnknown(optdata="B"*10)) == b'\x01\nBBBBBBBBBB' = HBHOptUnknown - Instantiation with specific values -str(HBHOptUnknown(optlen=9, optdata="B"*10)) == '\x01\tBBBBBBBBBB' +str(HBHOptUnknown(optlen=9, optdata="B"*10)) == b'\x01\tBBBBBBBBBB' = HBHOptUnknown - Dissection with specific values -a=HBHOptUnknown('\x01\tBBBBBBBBBB') +a=HBHOptUnknown(b'\x01\tBBBBBBBBBB') a.otype == 0x01 and a.optlen == 9 and a.optdata == "B"*9 and isinstance(a.payload, Raw) and a.payload.load == "B" @@ -1622,10 +1622,10 @@ a.otype == 0x01 and a.optlen == 9 and a.optdata == "B"*9 and isinstance(a.payloa + Test Pad1 Class = Pad1 - Basic Instantiation -str(Pad1()) == '\x00' +str(Pad1()) == b'\x00' = Pad1 - Basic Dissection -str(Pad1('\x00')) == '\x00' +str(Pad1(b'\x00')) == b'\x00' ############ @@ -1633,21 +1633,21 @@ str(Pad1('\x00')) == '\x00' + Test PadN Class = PadN - Basic Instantiation -str(PadN()) == '\x01\x00' +str(PadN()) == b'\x01\x00' = PadN - Optlen Automatic computation -str(PadN(optdata="B"*10)) == '\x01\nBBBBBBBBBB' +str(PadN(optdata="B"*10)) == b'\x01\nBBBBBBBBBB' = PadN - Basic Dissection -a=PadN('\x01\x00') +a=PadN(b'\x01\x00') a.otype == 1 and a.optlen == 0 and a.optdata == '' = PadN - Dissection with specific values -a=PadN('\x01\x0cBBBBBBBBBB') +a=PadN(b'\x01\x0cBBBBBBBBBB') a.otype == 1 and a.optlen == 12 and a.optdata == 'BBBBBBBBBB' = PadN - Instantiation with forced optlen -str(PadN(optdata="B"*10, optlen=9)) == '\x01\x09BBBBBBBBBB' +str(PadN(optdata="B"*10, optlen=9)) == b'\x01\x09BBBBBBBBBB' ############ @@ -1655,17 +1655,17 @@ str(PadN(optdata="B"*10, optlen=9)) == '\x01\x09BBBBBBBBBB' + Test RouterAlert Class (RFC 2711) = RouterAlert - Basic Instantiation -str(RouterAlert()) == '\x05\x02\x00\x00' +str(RouterAlert()) == b'\x05\x02\x00\x00' = RouterAlert - Basic Dissection -a=RouterAlert('\x05\x02\x00\x00') +a=RouterAlert(b'\x05\x02\x00\x00') a.otype == 0x05 and a.optlen == 2 and a.value == 00 = RouterAlert - Instantiation with specific values -str(RouterAlert(optlen=3, value=0xffff)) == '\x05\x03\xff\xff' +str(RouterAlert(optlen=3, value=0xffff)) == b'\x05\x03\xff\xff' = RouterAlert - Instantiation with specific values -a=RouterAlert('\x05\x03\xff\xff') +a=RouterAlert(b'\x05\x03\xff\xff') a.otype == 0x05 and a.optlen == 3 and a.value == 0xffff @@ -1674,17 +1674,17 @@ a.otype == 0x05 and a.optlen == 3 and a.value == 0xffff + Test Jumbo Class (RFC 2675) = Jumbo - Basic Instantiation -str(Jumbo()) == '\xc2\x04\x00\x00\x00\x00' +str(Jumbo()) == b'\xc2\x04\x00\x00\x00\x00' = Jumbo - Basic Dissection -a=Jumbo('\xc2\x04\x00\x00\x00\x00') +a=Jumbo(b'\xc2\x04\x00\x00\x00\x00') a.otype == 0xC2 and a.optlen == 4 and a.jumboplen == 0 = Jumbo - Instantiation with specific values -str(Jumbo(optlen=6, jumboplen=0xffffffff)) == '\xc2\x06\xff\xff\xff\xff' +str(Jumbo(optlen=6, jumboplen=0xffffffff)) == b'\xc2\x06\xff\xff\xff\xff' = Jumbo - Dissection with specific values -a=Jumbo('\xc2\x06\xff\xff\xff\xff') +a=Jumbo(b'\xc2\x06\xff\xff\xff\xff') a.otype == 0xc2 and a.optlen == 6 and a.jumboplen == 0xffffffff @@ -1693,23 +1693,23 @@ a.otype == 0xc2 and a.optlen == 6 and a.jumboplen == 0xffffffff + Test HAO Class (RFC 3775) = HAO - Basic Instantiation -str(HAO()) == '\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(HAO()) == b'\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = HAO - Basic Dissection -a=HAO('\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=HAO(b'\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.otype == 0xC9 and a.optlen == 16 and a.hoa == "::" = HAO - Instantiation with specific values -str(HAO(optlen=9, hoa="2001::ffff")) == '\xc9\t \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff' +str(HAO(optlen=9, hoa="2001::ffff")) == b'\xc9\t \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff' = HAO - Dissection with specific values -a=HAO('\xc9\t \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff') +a=HAO(b'\xc9\t \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff') a.otype == 0xC9 and a.optlen == 9 and a.hoa == "2001::ffff" = HAO - hashret p = IPv6()/IPv6ExtHdrDestOpt(options=HAO(hoa="2001:db8::1"))/ICMPv6EchoRequest() -p.hashret() == "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x00\x00\x00\x00" +p.hashret() == b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x00\x00\x00\x00" ############ @@ -1717,40 +1717,40 @@ p.hashret() == "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 + Test IPv6ExtHdrHopByHop() = IPv6ExtHdrHopByHop - Basic Instantiation -str(IPv6ExtHdrHopByHop()) == ';\x00\x01\x04\x00\x00\x00\x00' +str(IPv6ExtHdrHopByHop()) == b';\x00\x01\x04\x00\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with HAO option -str(IPv6ExtHdrHopByHop(options=[HAO()])) == ';\x02\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[HAO()])) == b';\x02\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with RouterAlert option -str(IPv6ExtHdrHopByHop(options=[RouterAlert()])) == ';\x00\x05\x02\x00\x00\x01\x00' +str(IPv6ExtHdrHopByHop(options=[RouterAlert()])) == b';\x00\x05\x02\x00\x00\x01\x00' = IPv6ExtHdrHopByHop - Instantiation with Jumbo option -str(IPv6ExtHdrHopByHop(options=[Jumbo()])) == ';\x00\xc2\x04\x00\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[Jumbo()])) == b';\x00\xc2\x04\x00\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with Pad1 option -str(IPv6ExtHdrHopByHop(options=[Pad1()])) == ';\x00\x00\x01\x03\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[Pad1()])) == b';\x00\x00\x01\x03\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with PadN option -str(IPv6ExtHdrHopByHop(options=[Pad1()])) == ';\x00\x00\x01\x03\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[Pad1()])) == b';\x00\x00\x01\x03\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with Jumbo, RouterAlert, HAO -str(IPv6ExtHdrHopByHop(options=[Jumbo(), RouterAlert(), HAO()])) == ';\x03\xc2\x04\x00\x00\x00\x00\x05\x02\x00\x00\x01\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[Jumbo(), RouterAlert(), HAO()])) == b';\x03\xc2\x04\x00\x00\x00\x00\x05\x02\x00\x00\x01\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with HAO, Jumbo, RouterAlert -str(IPv6ExtHdrHopByHop(options=[HAO(), Jumbo(), RouterAlert()])) == ';\x04\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\xc2\x04\x00\x00\x00\x00\x05\x02\x00\x00\x01\x02\x00\x00' +str(IPv6ExtHdrHopByHop(options=[HAO(), Jumbo(), RouterAlert()])) == b';\x04\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\xc2\x04\x00\x00\x00\x00\x05\x02\x00\x00\x01\x02\x00\x00' = IPv6ExtHdrHopByHop - Instantiation with RouterAlert, HAO, Jumbo -str(IPv6ExtHdrHopByHop(options=[RouterAlert(), HAO(), Jumbo()])) == ';\x03\x05\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\xc2\x04\x00\x00\x00\x00' +str(IPv6ExtHdrHopByHop(options=[RouterAlert(), HAO(), Jumbo()])) == b';\x03\x05\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\xc2\x04\x00\x00\x00\x00' = IPv6ExtHdrHopByHop - Basic Dissection -a=IPv6ExtHdrHopByHop(';\x00\x01\x04\x00\x00\x00\x00') -a.nh == 59 and a.len == 0 and len(a.options) == 1 and isinstance(a.options[0], PadN) and a.options[0].otype == 1 and a.options[0].optlen == 4 and a.options[0].optdata == '\x00'*4 +a=IPv6ExtHdrHopByHop(b';\x00\x01\x04\x00\x00\x00\x00') +a.nh == 59 and a.len == 0 and len(a.options) == 1 and isinstance(a.options[0], PadN) and a.options[0].otype == 1 and a.options[0].optlen == 4 and a.options[0].optdata == b'\x00'*4 #= IPv6ExtHdrHopByHop - Automatic length computation -#str(IPv6ExtHdrHopByHop(options=["toto"])) == '\x00\x00toto' +#str(IPv6ExtHdrHopByHop(options=["toto"])) == b'\x00\x00toto' #= IPv6ExtHdrHopByHop - Automatic length computation -#str(IPv6ExtHdrHopByHop(options=["toto"])) == '\x00\x00tototo' +#str(IPv6ExtHdrHopByHop(options=["toto"])) == b'\x00\x00tototo' ############ @@ -1758,17 +1758,17 @@ a.nh == 59 and a.len == 0 and len(a.options) == 1 and isinstance(a.options[0], P + Test ICMPv6ND_RS() class - ICMPv6 Type 133 Code 0 = ICMPv6ND_RS - Basic instantiation -str(ICMPv6ND_RS()) == '\x85\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6ND_RS()) == b'\x85\x00\x00\x00\x00\x00\x00\x00' = ICMPv6ND_RS - Basic instantiation with empty dst in IPv6 underlayer -str(IPv6(src="2001:db8::1")/ICMPv6ND_RS()) == '`\x00\x00\x00\x00\x08:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x85\x00M\xfe\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1")/ICMPv6ND_RS()) == b'`\x00\x00\x00\x00\x08:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x85\x00M\xfe\x00\x00\x00\x00' = ICMPv6ND_RS - Basic dissection -a=ICMPv6ND_RS('\x85\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6ND_RS(b'\x85\x00\x00\x00\x00\x00\x00\x00') a.type == 133 and a.code == 0 and a.cksum == 0 and a.res == 0 = ICMPv6ND_RS - Basic instantiation with empty dst in IPv6 underlayer -a=IPv6('`\x00\x00\x00\x00\x08:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x85\x00M\xfe\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x08:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x85\x00M\xfe\x00\x00\x00\x00') isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, ICMPv6ND_RS) and a.payload.type == 133 and a.payload.code == 0 and a.payload.cksum == 0x4dfe and a.payload.res == 0 @@ -1777,17 +1777,17 @@ isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, I + Test ICMPv6ND_RA() class - ICMPv6 Type 134 Code 0 = ICMPv6ND_RA - Basic Instantiation -str(ICMPv6ND_RA()) == '\x86\x00\x00\x00\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6ND_RA()) == b'\x86\x00\x00\x00\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6ND_RA - Basic instantiation with empty dst in IPv6 underlayer -str(IPv6(src="2001:db8::1")/ICMPv6ND_RA()) == '`\x00\x00\x00\x00\x10:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x86\x00E\xe7\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1")/ICMPv6ND_RA()) == b'`\x00\x00\x00\x00\x10:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x86\x00E\xe7\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6ND_RA - Basic dissection -a=ICMPv6ND_RA('\x86\x00\x00\x00\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6ND_RA(b'\x86\x00\x00\x00\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00') a.type == 134 and a.code == 0 and a.cksum == 0 and a.chlim == 0 and a.M == 0 and a.O == 0 and a.H == 0 and a.prf == 1 and a.res == 0 and a.routerlifetime == 1800 and a.reachabletime == 0 and a.retranstimer == 0 = ICMPv6ND_RA - Basic instantiation with empty dst in IPv6 underlayer -a=IPv6('`\x00\x00\x00\x00\x10:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x86\x00E\xe7\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x10:\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x86\x00E\xe7\x00\x08\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00') isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, ICMPv6ND_RA) and a.payload.type == 134 and a.code == 0 and a.cksum == 0x45e7 and a.chlim == 0 and a.M == 0 and a.O == 0 and a.H == 0 and a.prf == 1 and a.res == 0 and a.routerlifetime == 1800 and a.reachabletime == 0 and a.retranstimer == 0 @@ -1800,17 +1800,17 @@ isinstance(a, IPv6) and a.nh == 58 and a.hlim == 255 and isinstance(a.payload, I + ICMPv6ND_NS Class Test = ICMPv6ND_NS - Basic Instantiation -str(ICMPv6ND_NS()) == '\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6ND_NS()) == b'\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6ND_NS - Instantiation with specific values -str(ICMPv6ND_NS(code=0x11, res=3758096385, tgt="ffff::1111")) == '\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6ND_NS(code=0x11, res=3758096385, tgt="ffff::1111")) == b'\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6ND_NS - Basic Dissection -a=ICMPv6ND_NS('\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6ND_NS(b'\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.code==0 and a.res==0 and a.tgt=="::" = ICMPv6ND_NS - Dissection with specific values -a=ICMPv6ND_NS('\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6ND_NS(b'\x87\x11\x00\x00\xe0\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.code==0x11 and a.res==3758096385 and a.tgt=="ffff::1111" = ICMPv6ND_NS - IPv6 layer fields overloading @@ -1822,17 +1822,17 @@ a.nh == 58 and a.dst=="ff02::1" and a.hlim==255 + ICMPv6ND_NA Class Test = ICMPv6ND_NA - Basic Instantiation -str(ICMPv6ND_NA()) == '\x88\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6ND_NA()) == b'\x88\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6ND_NA - Instantiation with specific values -str(ICMPv6ND_NA(code=0x11, R=0, S=1, O=0, res=1, tgt="ffff::1111")) == '\x88\x11\x00\x00@\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6ND_NA(code=0x11, R=0, S=1, O=0, res=1, tgt="ffff::1111")) == b'\x88\x11\x00\x00@\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6ND_NA - Basic Dissection -a=ICMPv6ND_NA('\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6ND_NA(b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.code==0 and a.R==0 and a.S==0 and a.O==0 and a.res==0 and a.tgt=="::" = ICMPv6ND_NA - Dissection with specific values -a=ICMPv6ND_NA('\x88\x11\x00\x00@\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6ND_NA(b'\x88\x11\x00\x00@\x00\x00\x01\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.code==0x11 and a.R==0 and a.S==1 and a.O==0 and a.res==1 and a.tgt=="ffff::1111" = ICMPv6ND_NS - IPv6 layer fields overloading @@ -1846,9 +1846,9 @@ a.nh == 58 and a.dst=="ff02::1" and a.hlim==255 = ICMPv6ND_ND/ICMPv6ND_ND matching - test 1 # Sent NS -a=IPv6('`\x00\x00\x00\x00\x18:\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f\x1f\xff\xfe\xcaFP\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x00UC\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1') +a=IPv6(b'`\x00\x00\x00\x00\x18:\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f\x1f\xff\xfe\xcaFP\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x00UC\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1') # Received NA -b=IPv6('n\x00\x00\x00\x00 :\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f\x1f\xff\xfe\xcaFP\x88\x00\xf3F\xe0\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1\x02\x01\x00\x0f4\x8a\x8a\xa1') +b=IPv6(b'n\x00\x00\x00\x00 :\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f\x1f\xff\xfe\xcaFP\x88\x00\xf3F\xe0\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x0f4\xff\xfe\x8a\x8a\xa1\x02\x01\x00\x0f4\x8a\x8a\xa1') b.answers(a) @@ -1857,17 +1857,17 @@ b.answers(a) + ICMPv6NDOptUnknown Class Test = ICMPv6NDOptUnknown - Basic Instantiation -str(ICMPv6NDOptUnknown()) == '\x00\x02' +str(ICMPv6NDOptUnknown()) == b'\x00\x02' = ICMPv6NDOptUnknown - Instantiation with specific values -str(ICMPv6NDOptUnknown(len=4, data="somestring")) == '\x00\x04somestring' +str(ICMPv6NDOptUnknown(len=4, data="somestring")) == b'\x00\x04somestring' = ICMPv6NDOptUnknown - Basic Dissection -a=ICMPv6NDOptUnknown('\x00\x02') +a=ICMPv6NDOptUnknown(b'\x00\x02') a.type == 0 and a.len == 2 = ICMPv6NDOptUnknown - Dissection with specific values -a=ICMPv6NDOptUnknown('\x00\x04somestring') +a=ICMPv6NDOptUnknown(b'\x00\x04somestring') a.type == 0 and a.len==4 and a.data == "so" and isinstance(a.payload, Raw) and a.payload.load == "mestring" @@ -1876,17 +1876,17 @@ a.type == 0 and a.len==4 and a.data == "so" and isinstance(a.payload, Raw) and a + ICMPv6NDOptSrcLLAddr Class Test = ICMPv6NDOptSrcLLAddr - Basic Instantiation -str(ICMPv6NDOptSrcLLAddr()) == '\x01\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptSrcLLAddr()) == b'\x01\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptSrcLLAddr - Instantiation with specific values -str(ICMPv6NDOptSrcLLAddr(len=2, lladdr="11:11:11:11:11:11")) == '\x01\x02\x11\x11\x11\x11\x11\x11' +str(ICMPv6NDOptSrcLLAddr(len=2, lladdr="11:11:11:11:11:11")) == b'\x01\x02\x11\x11\x11\x11\x11\x11' = ICMPv6NDOptSrcLLAddr - Basic Dissection -a=ICMPv6NDOptSrcLLAddr('\x01\x01\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptSrcLLAddr(b'\x01\x01\x00\x00\x00\x00\x00\x00') a.type == 1 and a.len == 1 and a.lladdr == "00:00:00:00:00:00" = ICMPv6NDOptSrcLLAddr - Instantiation with specific values -a=ICMPv6NDOptSrcLLAddr('\x01\x02\x11\x11\x11\x11\x11\x11') +a=ICMPv6NDOptSrcLLAddr(b'\x01\x02\x11\x11\x11\x11\x11\x11') a.type == 1 and a.len == 2 and a.lladdr == "11:11:11:11:11:11" @@ -1895,17 +1895,17 @@ a.type == 1 and a.len == 2 and a.lladdr == "11:11:11:11:11:11" + ICMPv6NDOptDstLLAddr Class Test = ICMPv6NDOptDstLLAddr - Basic Instantiation -str(ICMPv6NDOptDstLLAddr()) == '\x02\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptDstLLAddr()) == b'\x02\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptDstLLAddr - Instantiation with specific values -str(ICMPv6NDOptDstLLAddr(len=2, lladdr="11:11:11:11:11:11")) == '\x02\x02\x11\x11\x11\x11\x11\x11' +str(ICMPv6NDOptDstLLAddr(len=2, lladdr="11:11:11:11:11:11")) == b'\x02\x02\x11\x11\x11\x11\x11\x11' = ICMPv6NDOptDstLLAddr - Basic Dissection -a=ICMPv6NDOptDstLLAddr('\x02\x01\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptDstLLAddr(b'\x02\x01\x00\x00\x00\x00\x00\x00') a.type == 2 and a.len == 1 and a.lladdr == "00:00:00:00:00:00" = ICMPv6NDOptDstLLAddr - Instantiation with specific values -a=ICMPv6NDOptDstLLAddr('\x02\x02\x11\x11\x11\x11\x11\x11') +a=ICMPv6NDOptDstLLAddr(b'\x02\x02\x11\x11\x11\x11\x11\x11') a.type == 2 and a.len == 2 and a.lladdr == "11:11:11:11:11:11" @@ -1914,17 +1914,17 @@ a.type == 2 and a.len == 2 and a.lladdr == "11:11:11:11:11:11" + ICMPv6NDOptPrefixInfo Class Test = ICMPv6NDOptPrefixInfo - Basic Instantiation -str(ICMPv6NDOptPrefixInfo()) == '\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptPrefixInfo()) == b'\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptPrefixInfo - Instantiation with specific values -str(ICMPv6NDOptPrefixInfo(len=5, prefixlen=64, L=0, A=0, R=1, res1=1, validlifetime=0x11111111, preferredlifetime=0x22222222, res2=0x33333333, prefix="2001:db8::1")) == '\x03\x05@!\x11\x11\x11\x11""""3333 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(ICMPv6NDOptPrefixInfo(len=5, prefixlen=64, L=0, A=0, R=1, res1=1, validlifetime=0x11111111, preferredlifetime=0x22222222, res2=0x33333333, prefix="2001:db8::1")) == b'\x03\x05@!\x11\x11\x11\x11""""3333 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = ICMPv6NDOptPrefixInfo - Basic Dissection -a=ICMPv6NDOptPrefixInfo('\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptPrefixInfo(b'\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.type == 3 and a.len == 4 and a.prefixlen == 0 and a.L == 1 and a.A == 1 and a.R == 0 and a.res1 == 0 and a.validlifetime == 0xffffffff and a.preferredlifetime == 0xffffffff and a.res2 == 0 and a.prefix == "::" = ICMPv6NDOptPrefixInfo - Instantiation with specific values -a=ICMPv6NDOptPrefixInfo('\x03\x05@!\x11\x11\x11\x11""""3333 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a=ICMPv6NDOptPrefixInfo(b'\x03\x05@!\x11\x11\x11\x11""""3333 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.type == 3 and a.len == 5 and a.prefixlen == 64 and a.L == 0 and a.A == 0 and a.R == 1 and a.res1 == 1 and a.validlifetime == 0x11111111 and a.preferredlifetime == 0x22222222 and a.res2 == 0x33333333 and a.prefix == "2001:db8::1" @@ -1934,37 +1934,37 @@ a.type == 3 and a.len == 5 and a.prefixlen == 64 and a.L == 0 and a.A == 0 and a = ICMPv6NDOptRedirectedHdr - Basic Instantiation ~ ICMPv6NDOptRedirectedHdr -str(ICMPv6NDOptRedirectedHdr()) == '\x04\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptRedirectedHdr()) == b'\x04\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptRedirectedHdr - Instantiation with specific values ~ ICMPv6NDOptRedirectedHdr -str(ICMPv6NDOptRedirectedHdr(len=0xff, res=0x1111, pkt="somestringthatisnotanipv6packet")) == '\x04\xff4369\x00\x00somestringthatisnotanipv' +str(ICMPv6NDOptRedirectedHdr(len=0xff, res=0x1111, pkt="somestringthatisnotanipv6packet")) == b'\x04\xff4369\x00\x00somestringthatisnotanipv' = ICMPv6NDOptRedirectedHdr - Instantiation with simple IPv6 packet (no upper layer) ~ ICMPv6NDOptRedirectedHdr -str(ICMPv6NDOptRedirectedHdr(pkt=IPv6())) == '\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(ICMPv6NDOptRedirectedHdr(pkt=IPv6())) == b'\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = ICMPv6NDOptRedirectedHdr - Basic Dissection ~ ICMPv6NDOptRedirectedHdr -a=ICMPv6NDOptRedirectedHdr('\x04\x00\x00\x00') +a=ICMPv6NDOptRedirectedHdr(b'\x04\x00\x00\x00') assert(a.type == 4) assert(a.len == 0) -assert(a.res == "\x00\x00") +assert(a.res == b"\x00\x00") assert(a.pkt == "") = ICMPv6NDOptRedirectedHdr - Disssection with specific values ~ ICMPv6NDOptRedirectedHdr -a=ICMPv6NDOptRedirectedHdr('\x04\xff\x11\x11\x00\x00\x00\x00somestringthatisnotanipv6pac') -a.type == 4 and a.len == 255 and a.res == '\x11\x11\x00\x00\x00\x00' and isinstance(a.pkt, Raw) and a.pkt.load == "somestringthatisnotanipv6pac" +a=ICMPv6NDOptRedirectedHdr(b'\x04\xff\x11\x11\x00\x00\x00\x00somestringthatisnotanipv6pac') +a.type == 4 and a.len == 255 and a.res == b'\x11\x11\x00\x00\x00\x00' and isinstance(a.pkt, Raw) and a.pkt.load == "somestringthatisnotanipv6pac" = ICMPv6NDOptRedirectedHdr - Dissection with cut IPv6 Header ~ ICMPv6NDOptRedirectedHdr -a=ICMPv6NDOptRedirectedHdr('\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -a.type == 4 and a.len == 6 and a.res == "\x00\x00\x00\x00\x00\x00" and isinstance(a.pkt, Raw) and a.pkt.load == '`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +a=ICMPv6NDOptRedirectedHdr(b'\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a.type == 4 and a.len == 6 and a.res == b"\x00\x00\x00\x00\x00\x00" and isinstance(a.pkt, Raw) and a.pkt.load == b'`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptRedirectedHdr - Complete dissection ~ ICMPv6NDOptRedirectedHdr -x=ICMPv6NDOptRedirectedHdr('\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +x=ICMPv6NDOptRedirectedHdr(b'\x04\x06\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') y=x.copy() del(y.len) x == ICMPv6NDOptRedirectedHdr(str(y)) @@ -1977,17 +1977,17 @@ x == ICMPv6NDOptRedirectedHdr(str(y)) + ICMPv6NDOptMTU Class Test = ICMPv6NDOptMTU - Basic Instantiation -str(ICMPv6NDOptMTU()) == '\x05\x01\x00\x00\x00\x00\x05\x00' +str(ICMPv6NDOptMTU()) == b'\x05\x01\x00\x00\x00\x00\x05\x00' = ICMPv6NDOptMTU - Instantiation with specific values -str(ICMPv6NDOptMTU(len=2, res=0x1111, mtu=1500)) == '\x05\x02\x11\x11\x00\x00\x05\xdc' +str(ICMPv6NDOptMTU(len=2, res=0x1111, mtu=1500)) == b'\x05\x02\x11\x11\x00\x00\x05\xdc' = ICMPv6NDOptMTU - Basic dissection -a=ICMPv6NDOptMTU('\x05\x01\x00\x00\x00\x00\x05\x00') +a=ICMPv6NDOptMTU(b'\x05\x01\x00\x00\x00\x00\x05\x00') a.type == 5 and a.len == 1 and a.res == 0 and a.mtu == 1280 = ICMPv6NDOptMTU - Dissection with specific values -a=ICMPv6NDOptMTU('\x05\x02\x11\x11\x00\x00\x05\xdc') +a=ICMPv6NDOptMTU(b'\x05\x02\x11\x11\x00\x00\x05\xdc') a.type == 5 and a.len == 2 and a.res == 0x1111 and a.mtu == 1500 @@ -1996,17 +1996,17 @@ a.type == 5 and a.len == 2 and a.res == 0x1111 and a.mtu == 1500 + ICMPv6NDOptShortcutLimit Class Test (RFC2491) = ICMPv6NDOptShortcutLimit - Basic Instantiation -str(ICMPv6NDOptShortcutLimit()) == '\x06\x01(\x00\x00\x00\x00\x00' +str(ICMPv6NDOptShortcutLimit()) == b'\x06\x01(\x00\x00\x00\x00\x00' = ICMPv6NDOptShortcutLimit - Instantiation with specific values -str(ICMPv6NDOptShortcutLimit(len=2, shortcutlim=0x11, res1=0xee, res2=0xaaaaaaaa)) == '\x06\x02\x11\xee\xaa\xaa\xaa\xaa' +str(ICMPv6NDOptShortcutLimit(len=2, shortcutlim=0x11, res1=0xee, res2=0xaaaaaaaa)) == b'\x06\x02\x11\xee\xaa\xaa\xaa\xaa' = ICMPv6NDOptShortcutLimit - Basic Dissection -a=ICMPv6NDOptShortcutLimit('\x06\x01(\x00\x00\x00\x00\x00') +a=ICMPv6NDOptShortcutLimit(b'\x06\x01(\x00\x00\x00\x00\x00') a.type == 6 and a.len == 1 and a.shortcutlim == 40 and a.res1 == 0 and a.res2 == 0 = ICMPv6NDOptShortcutLimit - Dissection with specific values -a=ICMPv6NDOptShortcutLimit('\x06\x02\x11\xee\xaa\xaa\xaa\xaa') +a=ICMPv6NDOptShortcutLimit(b'\x06\x02\x11\xee\xaa\xaa\xaa\xaa') a.len==2 and a.shortcutlim==0x11 and a.res1==0xee and a.res2==0xaaaaaaaa @@ -2015,17 +2015,17 @@ a.len==2 and a.shortcutlim==0x11 and a.res1==0xee and a.res2==0xaaaaaaaa + ICMPv6NDOptAdvInterval Class Test = ICMPv6NDOptAdvInterval - Basic Instantiation -str(ICMPv6NDOptAdvInterval()) == '\x07\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptAdvInterval()) == b'\x07\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptAdvInterval - Instantiation with specific values -str(ICMPv6NDOptAdvInterval(len=2, res=0x1111, advint=0xffffffff)) == '\x07\x02\x11\x11\xff\xff\xff\xff' +str(ICMPv6NDOptAdvInterval(len=2, res=0x1111, advint=0xffffffff)) == b'\x07\x02\x11\x11\xff\xff\xff\xff' = ICMPv6NDOptAdvInterval - Basic dissection -a=ICMPv6NDOptAdvInterval('\x07\x01\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptAdvInterval(b'\x07\x01\x00\x00\x00\x00\x00\x00') a.type == 7 and a.len == 1 and a.res == 0 and a.advint == 0 = ICMPv6NDOptAdvInterval - Dissection with specific values -a=ICMPv6NDOptAdvInterval('\x07\x02\x11\x11\xff\xff\xff\xff') +a=ICMPv6NDOptAdvInterval(b'\x07\x02\x11\x11\xff\xff\xff\xff') a.type == 7 and a.len == 2 and a.res == 0x1111 and a.advint == 0xffffffff @@ -2034,17 +2034,17 @@ a.type == 7 and a.len == 2 and a.res == 0x1111 and a.advint == 0xffffffff + ICMPv6NDOptHAInfo Class Test = ICMPv6NDOptHAInfo - Basic Instantiation -str(ICMPv6NDOptHAInfo()) == '\x08\x01\x00\x00\x00\x00\x00\x01' +str(ICMPv6NDOptHAInfo()) == b'\x08\x01\x00\x00\x00\x00\x00\x01' = ICMPv6NDOptHAInfo - Instantiation with specific values -str(ICMPv6NDOptHAInfo(len=2, res=0x1111, pref=0x2222, lifetime=0x3333)) == '\x08\x02\x11\x11""33' +str(ICMPv6NDOptHAInfo(len=2, res=0x1111, pref=0x2222, lifetime=0x3333)) == b'\x08\x02\x11\x11""33' = ICMPv6NDOptHAInfo - Basic dissection -a=ICMPv6NDOptHAInfo('\x08\x01\x00\x00\x00\x00\x00\x01') +a=ICMPv6NDOptHAInfo(b'\x08\x01\x00\x00\x00\x00\x00\x01') a.type == 8 and a.len == 1 and a.res == 0 and a.pref == 0 and a.lifetime == 1 = ICMPv6NDOptHAInfo - Dissection with specific values -a=ICMPv6NDOptHAInfo('\x08\x02\x11\x11""33') +a=ICMPv6NDOptHAInfo(b'\x08\x02\x11\x11""33') a.type == 8 and a.len == 2 and a.res == 0x1111 and a.pref == 0x2222 and a.lifetime == 0x3333 @@ -2053,27 +2053,27 @@ a.type == 8 and a.len == 2 and a.res == 0x1111 and a.pref == 0x2222 and a.lifeti + ICMPv6NDOptSrcAddrList Class Test = ICMPv6NDOptSrcAddrList - Basic Instantiation -str(ICMPv6NDOptSrcAddrList()) == '\t\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptSrcAddrList()) == b'\t\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptSrcAddrList - Instantiation with specific values (auto len) -str(ICMPv6NDOptSrcAddrList(res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == '\t\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptSrcAddrList(res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == b'\t\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptSrcAddrList - Instantiation with specific values -str(ICMPv6NDOptSrcAddrList(len=3, res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == '\t\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptSrcAddrList(len=3, res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == b'\t\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptSrcAddrList - Basic Dissection -a=ICMPv6NDOptSrcAddrList('\t\x01\x00\x00\x00\x00\x00\x00') -a.type == 9 and a.len == 1 and a.res == '\x00\x00\x00\x00\x00\x00' and not a.addrlist +a=ICMPv6NDOptSrcAddrList(b'\t\x01\x00\x00\x00\x00\x00\x00') +a.type == 9 and a.len == 1 and a.res == b'\x00\x00\x00\x00\x00\x00' and not a.addrlist = ICMPv6NDOptSrcAddrList - Dissection with specific values (auto len) -a=ICMPv6NDOptSrcAddrList('\t\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptSrcAddrList(b'\t\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.type == 9 and a.len == 5 and a.res == 'BBBBBB' and len(a.addrlist) == 2 and a.addrlist[0] == "ffff::ffff" and a.addrlist[1] == "1111::1111" = ICMPv6NDOptSrcAddrList - Dissection with specific values conf.debug_dissector = False -a=ICMPv6NDOptSrcAddrList('\t\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptSrcAddrList(b'\t\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') conf.debug_dissector = True -a.type == 9 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a.addrlist[0] == "ffff::ffff" and isinstance(a.payload, Raw) and a.payload.load == '\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +a.type == 9 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a.addrlist[0] == "ffff::ffff" and isinstance(a.payload, Raw) and a.payload.load == b'\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' ############ @@ -2081,27 +2081,27 @@ a.type == 9 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a. + ICMPv6NDOptTgtAddrList Class Test = ICMPv6NDOptTgtAddrList - Basic Instantiation -str(ICMPv6NDOptTgtAddrList()) == '\n\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptTgtAddrList()) == b'\n\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptTgtAddrList - Instantiation with specific values (auto len) -str(ICMPv6NDOptTgtAddrList(res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == '\n\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptTgtAddrList(res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == b'\n\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptTgtAddrList - Instantiation with specific values -str(ICMPv6NDOptTgtAddrList(len=3, res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == '\n\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptTgtAddrList(len=3, res="BBBBBB", addrlist=["ffff::ffff", "1111::1111"])) == b'\n\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptTgtAddrList - Basic Dissection -a=ICMPv6NDOptTgtAddrList('\n\x01\x00\x00\x00\x00\x00\x00') -a.type == 10 and a.len == 1 and a.res == '\x00\x00\x00\x00\x00\x00' and not a.addrlist +a=ICMPv6NDOptTgtAddrList(b'\n\x01\x00\x00\x00\x00\x00\x00') +a.type == 10 and a.len == 1 and a.res == b'\x00\x00\x00\x00\x00\x00' and not a.addrlist = ICMPv6NDOptTgtAddrList - Dissection with specific values (auto len) -a=ICMPv6NDOptTgtAddrList('\n\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptTgtAddrList(b'\n\x05BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.type == 10 and a.len == 5 and a.res == 'BBBBBB' and len(a.addrlist) == 2 and a.addrlist[0] == "ffff::ffff" and a.addrlist[1] == "1111::1111" = ICMPv6NDOptTgtAddrList - Instantiation with specific values conf.debug_dissector = False -a=ICMPv6NDOptTgtAddrList('\n\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptTgtAddrList(b'\n\x03BBBBBB\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') conf.debug_dissector = True -a.type == 10 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a.addrlist[0] == "ffff::ffff" and isinstance(a.payload, Raw) and a.payload.load == '\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +a.type == 10 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a.addrlist[0] == "ffff::ffff" and isinstance(a.payload, Raw) and a.payload.load == b'\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' ############ @@ -2109,17 +2109,17 @@ a.type == 10 and a.len == 3 and a.res == 'BBBBBB' and len(a.addrlist) == 1 and a + ICMPv6NDOptIPAddr Class Test (RFC 4068) = ICMPv6NDOptIPAddr - Basic Instantiation -str(ICMPv6NDOptIPAddr()) == '\x11\x03\x01@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptIPAddr()) == b'\x11\x03\x01@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptIPAddr - Instantiation with specific values -str(ICMPv6NDOptIPAddr(len=5, optcode=0xff, plen=40, res=0xeeeeeeee, addr="ffff::1111")) == '\x11\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptIPAddr(len=5, optcode=0xff, plen=40, res=0xeeeeeeee, addr="ffff::1111")) == b'\x11\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptIPAddr - Basic Dissection -a=ICMPv6NDOptIPAddr('\x11\x03\x01@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptIPAddr(b'\x11\x03\x01@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.type == 17 and a.len == 3 and a.optcode == 1 and a.plen == 64 and a.res == 0 and a.addr == "::" = ICMPv6NDOptIPAddr - Dissection with specific values -a=ICMPv6NDOptIPAddr('\x11\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptIPAddr(b'\x11\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.type == 17 and a.len == 5 and a.optcode == 0xff and a.plen == 40 and a.res == 0xeeeeeeee and a.addr == "ffff::1111" @@ -2128,17 +2128,17 @@ a.type == 17 and a.len == 5 and a.optcode == 0xff and a.plen == 40 and a.res == + ICMPv6NDOptNewRtrPrefix Class Test (RFC 4068) = ICMPv6NDOptNewRtrPrefix - Basic Instantiation -str(ICMPv6NDOptNewRtrPrefix()) == '\x12\x03\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptNewRtrPrefix()) == b'\x12\x03\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptNewRtrPrefix - Instantiation with specific values -str(ICMPv6NDOptNewRtrPrefix(len=5, optcode=0xff, plen=40, res=0xeeeeeeee, prefix="ffff::1111")) == '\x12\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptNewRtrPrefix(len=5, optcode=0xff, plen=40, res=0xeeeeeeee, prefix="ffff::1111")) == b'\x12\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptNewRtrPrefix - Basic Dissection -a=ICMPv6NDOptNewRtrPrefix('\x12\x03\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptNewRtrPrefix(b'\x12\x03\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.type == 18 and a.len == 3 and a.optcode == 0 and a.plen == 64 and a.res == 0 and a.prefix == "::" = ICMPv6NDOptNewRtrPrefix - Dissection with specific values -a=ICMPv6NDOptNewRtrPrefix('\x12\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptNewRtrPrefix(b'\x12\x05\xff(\xee\xee\xee\xee\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.type == 18 and a.len == 5 and a.optcode == 0xff and a.plen == 40 and a.res == 0xeeeeeeee and a.prefix == "ffff::1111" @@ -2147,17 +2147,17 @@ a.type == 18 and a.len == 5 and a.optcode == 0xff and a.plen == 40 and a.res == + ICMPv6NDOptLLA Class Test (RFC 4068) = ICMPv6NDOptLLA - Basic Instantiation -str(ICMPv6NDOptLLA()) == '\x13\x01\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptLLA()) == b'\x13\x01\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptLLA - Instantiation with specific values -str(ICMPv6NDOptLLA(len=2, optcode=3, lla="ff:11:ff:11:ff:11")) == '\x13\x02\x03\xff\x11\xff\x11\xff\x11' +str(ICMPv6NDOptLLA(len=2, optcode=3, lla="ff:11:ff:11:ff:11")) == b'\x13\x02\x03\xff\x11\xff\x11\xff\x11' = ICMPv6NDOptLLA - Basic Dissection -a=ICMPv6NDOptLLA('\x13\x01\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptLLA(b'\x13\x01\x00\x00\x00\x00\x00\x00\x00') a.type == 19 and a.len == 1 and a.optcode == 0 and a.lla == "00:00:00:00:00:00" = ICMPv6NDOptLLA - Dissection with specific values -a=ICMPv6NDOptLLA('\x13\x02\x03\xff\x11\xff\x11\xff\x11') +a=ICMPv6NDOptLLA(b'\x13\x02\x03\xff\x11\xff\x11\xff\x11') a.type == 19 and a.len == 2 and a.optcode == 3 and a.lla == "ff:11:ff:11:ff:11" @@ -2166,32 +2166,32 @@ a.type == 19 and a.len == 2 and a.optcode == 3 and a.lla == "ff:11:ff:11:ff:11" + ICMPv6NDOptRouteInfo Class Test = ICMPv6NDOptRouteInfo - Basic Instantiation -str(ICMPv6NDOptRouteInfo()) == '\x18\x01\x00\x00\xff\xff\xff\xff' +str(ICMPv6NDOptRouteInfo()) == b'\x18\x01\x00\x00\xff\xff\xff\xff' = ICMPv6NDOptRouteInfo - Instantiation with forced prefix but no length -str(ICMPv6NDOptRouteInfo(prefix="2001:db8:1:1:1:1:1:1")) == '\x18\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01' +str(ICMPv6NDOptRouteInfo(prefix="2001:db8:1:1:1:1:1:1")) == b'\x18\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01' = ICMPv6NDOptRouteInfo - Instantiation with forced length values (1/4) -str(ICMPv6NDOptRouteInfo(len=1, prefix="2001:db8:1:1:1:1:1:1")) == '\x18\x01\x00\x00\xff\xff\xff\xff' +str(ICMPv6NDOptRouteInfo(len=1, prefix="2001:db8:1:1:1:1:1:1")) == b'\x18\x01\x00\x00\xff\xff\xff\xff' = ICMPv6NDOptRouteInfo - Instantiation with forced length values (2/4) -str(ICMPv6NDOptRouteInfo(len=2, prefix="2001:db8:1:1:1:1:1:1")) == '\x18\x02\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01' +str(ICMPv6NDOptRouteInfo(len=2, prefix="2001:db8:1:1:1:1:1:1")) == b'\x18\x02\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01' = ICMPv6NDOptRouteInfo - Instantiation with forced length values (3/4) -str(ICMPv6NDOptRouteInfo(len=3, prefix="2001:db8:1:1:1:1:1:1")) == '\x18\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01' +str(ICMPv6NDOptRouteInfo(len=3, prefix="2001:db8:1:1:1:1:1:1")) == b'\x18\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01' = ICMPv6NDOptRouteInfo - Instantiation with forced length values (4/4) -str(ICMPv6NDOptRouteInfo(len=4, prefix="2001:db8:1:1:1:1:1:1")) == '\x18\x04\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptRouteInfo(len=4, prefix="2001:db8:1:1:1:1:1:1")) == b'\x18\x04\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptRouteInfo - Instantiation with specific values -str(ICMPv6NDOptRouteInfo(len=6, plen=0x11, res1=1, prf=3, res2=1, rtlifetime=0x22222222, prefix="2001:db8::1")) == '\x18\x06\x119"""" \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptRouteInfo(len=6, plen=0x11, res1=1, prf=3, res2=1, rtlifetime=0x22222222, prefix="2001:db8::1")) == b'\x18\x06\x119"""" \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptRouteInfo - Basic dissection -a=ICMPv6NDOptRouteInfo('\x18\x03\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptRouteInfo(b'\x18\x03\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.type == 24 and a.len == 3 and a.plen == 0 and a.res1 == 0 and a.prf == 0 and a.res2 == 0 and a.rtlifetime == 0xffffffff and a. prefix == "::" = ICMPv6NDOptRouteInfo - Dissection with specific values -a=ICMPv6NDOptRouteInfo('\x18\x04\x119"""" \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a=ICMPv6NDOptRouteInfo(b'\x18\x04\x119"""" \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.plen == 0x11 and a.res1 == 1 and a.prf == 3 and a.res2 == 1 and a.rtlifetime == 0x22222222 and a.prefix == "2001:db8::1" @@ -2200,17 +2200,17 @@ a.plen == 0x11 and a.res1 == 1 and a.prf == 3 and a.res2 == 1 and a.rtlifetime = + ICMPv6NDOptMAP Class Test = ICMPv6NDOptMAP - Basic Instantiation -str(ICMPv6NDOptMAP()) == '\x17\x03\x1f\x80\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptMAP()) == b'\x17\x03\x1f\x80\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptMAP - Instantiation with specific values -str(ICMPv6NDOptMAP(len=5, dist=3, pref=10, R=0, res=1, validlifetime=0x11111111, addr="ffff::1111")) == '\x17\x05:\x01\x11\x11\x11\x11\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' +str(ICMPv6NDOptMAP(len=5, dist=3, pref=10, R=0, res=1, validlifetime=0x11111111, addr="ffff::1111")) == b'\x17\x05:\x01\x11\x11\x11\x11\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11' = ICMPv6NDOptMAP - Basic Dissection -a=ICMPv6NDOptMAP('\x17\x03\x1f\x80\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptMAP(b'\x17\x03\x1f\x80\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.type==23 and a.len==3 and a.dist==1 and a.pref==15 and a.R==1 and a.res==0 and a.validlifetime==0xffffffff and a.addr=="::" = ICMPv6NDOptMAP - Dissection with specific values -a=ICMPv6NDOptMAP('\x17\x05:\x01\x11\x11\x11\x11\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') +a=ICMPv6NDOptMAP(b'\x17\x05:\x01\x11\x11\x11\x11\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11') a.type==23 and a.len==5 and a.dist==3 and a.pref==10 and a.R==0 and a.res==1 and a.validlifetime==0x11111111 and a.addr=="ffff::1111" @@ -2219,27 +2219,27 @@ a.type==23 and a.len==5 and a.dist==3 and a.pref==10 and a.R==0 and a.res==1 and + ICMPv6NDOptRDNSS Class Test = ICMPv6NDOptRDNSS - Basic Instantiation -str(ICMPv6NDOptRDNSS()) == '\x19\x01\x00\x00\xff\xff\xff\xff' +str(ICMPv6NDOptRDNSS()) == b'\x19\x01\x00\x00\xff\xff\xff\xff' = ICMPv6NDOptRDNSS - Basic instantiation with 1 DNS address -str(ICMPv6NDOptRDNSS(dns=["2001:db8::1"])) == '\x19\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(ICMPv6NDOptRDNSS(dns=["2001:db8::1"])) == b'\x19\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = ICMPv6NDOptRDNSS - Basic instantiation with 2 DNS addresses -str(ICMPv6NDOptRDNSS(dns=["2001:db8::1", "2001:db8::2"])) == '\x19\x05\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(ICMPv6NDOptRDNSS(dns=["2001:db8::1", "2001:db8::2"])) == b'\x19\x05\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = ICMPv6NDOptRDNSS - Instantiation with specific values -str(ICMPv6NDOptRDNSS(len=43, res=0xaaee, lifetime=0x11111111, dns=["2001:db8::2"])) == '\x19+\xaa\xee\x11\x11\x11\x11 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(ICMPv6NDOptRDNSS(len=43, res=0xaaee, lifetime=0x11111111, dns=["2001:db8::2"])) == b'\x19+\xaa\xee\x11\x11\x11\x11 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = ICMPv6NDOptRDNSS - Basic Dissection -a=ICMPv6NDOptRDNSS('\x19\x01\x00\x00\xff\xff\xff\xff') +a=ICMPv6NDOptRDNSS(b'\x19\x01\x00\x00\xff\xff\xff\xff') a.type==25 and a.len==1 and a.res == 0 and a.dns==[] = ICMPv6NDOptRDNSS - Dissection (with 1 DNS address) -a=ICMPv6NDOptRDNSS('\x19\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a=ICMPv6NDOptRDNSS(b'\x19\x03\x00\x00\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.type==25 and a.len==3 and a.res ==0 and len(a.dns) == 1 and a.dns[0] == "2001:db8::1" = ICMPv6NDOptRDNSS - Dissection (with 2 DNS addresses) -a=ICMPv6NDOptRDNSS('\x19\x05\xaa\xee\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a=ICMPv6NDOptRDNSS(b'\x19\x05\xaa\xee\xff\xff\xff\xff \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.type==25 and a.len==5 and a.res == 0xaaee and len(a.dns) == 2 and a.dns[0] == "2001:db8::1" and a.dns[1] == "2001:db8::2" @@ -2248,23 +2248,23 @@ a.type==25 and a.len==5 and a.res == 0xaaee and len(a.dns) == 2 and a.dns[0] == + ICMPv6NDOptDNSSL Class Test = ICMPv6NDOptDNSSL - Basic Instantiation -str(ICMPv6NDOptDNSSL()) == '\x1f\x01\x00\x00\xff\xff\xff\xff' +str(ICMPv6NDOptDNSSL()) == b'\x1f\x01\x00\x00\xff\xff\xff\xff' = ICMPv6NDOptDNSSL - Instantiation with 1 search domain, as seen in the wild -str(ICMPv6NDOptDNSSL(lifetime=60, searchlist=["home."])) == '\x1f\x02\x00\x00\x00\x00\x00<\x04home\x00\x00\x00' +str(ICMPv6NDOptDNSSL(lifetime=60, searchlist=["home."])) == b'\x1f\x02\x00\x00\x00\x00\x00<\x04home\x00\x00\x00' = ICMPv6NDOptDNSSL - Basic instantiation with 2 search domains -str(ICMPv6NDOptDNSSL(searchlist=["home.", "office."])) == '\x1f\x03\x00\x00\xff\xff\xff\xff\x04home\x00\x06office\x00\x00\x00' +str(ICMPv6NDOptDNSSL(searchlist=["home.", "office."])) == b'\x1f\x03\x00\x00\xff\xff\xff\xff\x04home\x00\x06office\x00\x00\x00' = ICMPv6NDOptDNSSL - Basic instantiation with 3 search domains -str(ICMPv6NDOptDNSSL(searchlist=["home.", "office.", "here.there."])) == '\x1f\x05\x00\x00\xff\xff\xff\xff\x04home\x00\x06office\x00\x04here\x05there\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptDNSSL(searchlist=["home.", "office.", "here.there."])) == b'\x1f\x05\x00\x00\xff\xff\xff\xff\x04home\x00\x06office\x00\x04here\x05there\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptDNSSL - Basic Dissection -p = ICMPv6NDOptDNSSL('\x1f\x01\x00\x00\xff\xff\xff\xff') +p = ICMPv6NDOptDNSSL(b'\x1f\x01\x00\x00\xff\xff\xff\xff') p.type == 31 and p.len == 1 and p.res == 0 and p.searchlist == [] = ICMPv6NDOptDNSSL - Basic Dissection with specific values -p = ICMPv6NDOptDNSSL('\x1f\x02\x00\x00\x00\x00\x00<\x04home\x00\x00\x00') +p = ICMPv6NDOptDNSSL(b'\x1f\x02\x00\x00\x00\x00\x00<\x04home\x00\x00\x00') p.type == 31 and p.len == 2 and p.res == 0 and p.lifetime == 60 and p.searchlist == ["home."] @@ -2273,10 +2273,10 @@ p.type == 31 and p.len == 2 and p.res == 0 and p.lifetime == 60 and p.searchlist + ICMPv6NDOptEFA Class Test = ICMPv6NDOptEFA - Basic Instantiation -str(ICMPv6NDOptEFA()) == '\x1a\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NDOptEFA()) == b'\x1a\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NDOptEFA - Basic Dissection -a=ICMPv6NDOptEFA('\x1a\x01\x00\x00\x00\x00\x00\x00') +a=ICMPv6NDOptEFA(b'\x1a\x01\x00\x00\x00\x00\x00\x00') a.type==26 and a.len==1 and a.res == 0 @@ -2285,11 +2285,11 @@ a.type==26 and a.len==1 and a.res == 0 + Test Node Information Query - ICMPv6NIQueryNOOP = ICMPv6NIQueryNOOP - Basic Instantiation -str(ICMPv6NIQueryNOOP(nonce="\x00"*8)) == '\x8b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NIQueryNOOP(nonce=b"\x00"*8)) == b'\x8b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NIQueryNOOP - Basic Dissection -a = ICMPv6NIQueryNOOP('\x8b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -a.type == 139 and a.code == 1 and a.cksum == 0 and a.qtype == 0 and a.unused == 0 and a.flags == 0 and a.nonce == "\x00"*8 and a.data == "" +a = ICMPv6NIQueryNOOP(b'\x8b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a.type == 139 and a.code == 1 and a.cksum == 0 and a.qtype == 0 and a.unused == 0 and a.flags == 0 and a.nonce == b"\x00"*8 and a.data == "" ############ @@ -2298,14 +2298,14 @@ a.type == 139 and a.code == 1 and a.cksum == 0 and a.qtype == 0 and a.unused == = ICMPv6NIQueryName - single label DNS name (internal) a=ICMPv6NIQueryName(data="abricot").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x07abricot\x00\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x07abricot\x00\x00' = ICMPv6NIQueryName - single label DNS name ICMPv6NIQueryName(data="abricot").data == "abricot" = ICMPv6NIQueryName - fqdn (internal) a=ICMPv6NIQueryName(data="n.d.org").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x01n\x01d\x03org\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x01n\x01d\x03org\x00' = ICMPv6NIQueryName - fqdn ICMPv6NIQueryName(data="n.d.org").data == "n.d.org" @@ -2338,14 +2338,14 @@ ICMPv6NIQueryName in p and p[ICMPv6NIQueryName].data == "n.d.org" a = ICMPv6NIQueryIPv6(data="abricot") ls(a) a = a.getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x07abricot\x00\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x07abricot\x00\x00' = ICMPv6NIQueryIPv6 - single label DNS name ICMPv6NIQueryIPv6(data="abricot").data == "abricot" = ICMPv6NIQueryIPv6 - fqdn (internal) a=ICMPv6NIQueryIPv6(data="n.d.org").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x01n\x01d\x03org\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x01n\x01d\x03org\x00' = ICMPv6NIQueryIPv6 - fqdn ICMPv6NIQueryIPv6(data="n.d.org").data == "n.d.org" @@ -2371,14 +2371,14 @@ ICMPv6NIQueryIPv6(data="169.254.253.252").data == '169.254.253.252' = ICMPv6NIQueryIPv4 - single label DNS name (internal) a=ICMPv6NIQueryIPv4(data="abricot").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x07abricot\x00\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x07abricot\x00\x00' = ICMPv6NIQueryIPv4 - single label DNS name ICMPv6NIQueryIPv4(data="abricot").data == "abricot" = ICMPv6NIQueryIPv4 - fqdn (internal) a=ICMPv6NIQueryIPv4(data="n.d.org").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == '\x01n\x01d\x03org\x00' +type(a) is tuple and len(a) == 2 and a[0] == 1 and a[1] == b'\x01n\x01d\x03org\x00' = ICMPv6NIQueryIPv4 - fqdn ICMPv6NIQueryIPv4(data="n.d.org").data == "n.d.org" @@ -2421,7 +2421,7 @@ l = str(ICMPv6NIQueryNOOP(flags="L", nonce="A"*8))[6:8] s = str(ICMPv6NIQueryNOOP(flags="S", nonce="A"*8))[6:8] g = str(ICMPv6NIQueryNOOP(flags="G", nonce="A"*8))[6:8] allflags = str(ICMPv6NIQueryNOOP(flags="TALCLSG", nonce="A"*8))[6:8] -t == '\x00\x01' and a == '\x00\x02' and c == '\x00\x04' and l == '\x00\x08' and s == '\x00\x10' and g == '\x00\x20' and allflags == '\x00\x3F' +t == b'\x00\x01' and a == b'\x00\x02' and c == b'\x00\x04' and l == b'\x00\x08' and s == b'\x00\x10' and g == b'\x00\x20' and allflags == b'\x00\x3F' = ICMPv6NIReply* - flags handling (Test 1) @@ -2443,7 +2443,7 @@ l = str(ICMPv6NIReplyNOOP(flags="L", nonce="A"*8))[6:8] s = str(ICMPv6NIReplyNOOP(flags="S", nonce="A"*8))[6:8] g = str(ICMPv6NIReplyNOOP(flags="G", nonce="A"*8))[6:8] allflags = str(ICMPv6NIReplyNOOP(flags="TALCLSG", nonce="A"*8))[6:8] -t == '\x00\x01' and a == '\x00\x02' and c == '\x00\x04' and l == '\x00\x08' and s == '\x00\x10' and g == '\x00\x20' and allflags == '\x00\x3F' +t == b'\x00\x01' and a == b'\x00\x02' and c == b'\x00\x04' and l == b'\x00\x08' and s == b'\x00\x10' and g == b'\x00\x20' and allflags == b'\x00\x3F' = ICMPv6NIQuery* - Flags Default values @@ -2600,28 +2600,28 @@ ICMPv6NIReplyNOOP(data="169.254.253.010").data == "169.254.253.010" = ICMPv6NIReplyName - single label DNS name as a string (without ttl) (internal) a=ICMPv6NIReplyName(data="abricot").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x07abricot\x00\x00' +type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == b'\x07abricot\x00\x00' = ICMPv6NIReplyName - single label DNS name as a string (without ttl) ICMPv6NIReplyName(data="abricot").data == [0, "abricot"] = ICMPv6NIReplyName - fqdn name as a string (without ttl) (internal) a=ICMPv6NIReplyName(data="n.d.tld").getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x01n\x01d\x03tld\x00' +type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == b'\x01n\x01d\x03tld\x00' = ICMPv6NIReplyName - fqdn name as a string (without ttl) ICMPv6NIReplyName(data="n.d.tld").data == [0, 'n.d.tld'] = ICMPv6NIReplyName - list of 2 single label DNS names (without ttl) (internal) a=ICMPv6NIReplyName(data=["abricot", "poire"]).getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == '\x07abricot\x00\x00\x05poire\x00\x00' +type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 0 and a[1][1] == b'\x07abricot\x00\x00\x05poire\x00\x00' = ICMPv6NIReplyName - list of 2 single label DNS names (without ttl) ICMPv6NIReplyName(data=["abricot", "poire"]).data == [0, "abricot", "poire"] = ICMPv6NIReplyName - [ttl, single-label, single-label, fqdn] (internal) a=ICMPv6NIReplyName(data=[42, "abricot", "poire", "n.d.tld"]).getfieldval("data") -type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 42 and a[1][1] == '\x07abricot\x00\x00\x05poire\x00\x00\x01n\x01d\x03tld\x00' +type(a) is tuple and len(a) == 2 and a[0] == 2 and type(a[1]) is list and len(a[1]) == 2 and a[1][0] == 42 and a[1][1] == b'\x07abricot\x00\x00\x05poire\x00\x00\x01n\x01d\x03tld\x00' = ICMPv6NIReplyName - [ttl, single-label, single-label, fqdn] ICMPv6NIReplyName(data=[42, "abricot", "poire", "n.d.tld"]).data == [42, "abricot", "poire", "n.d.tld"] @@ -2726,11 +2726,11 @@ ICMPv6NIReplyIPv4 in p and p.data == [(2807, "192.168.0.1")] ############ + Test Node Information Query - ICMPv6NIReplyRefuse = ICMPv6NIReplyRefuse - basic instantiation -str(ICMPv6NIReplyRefuse())[:8] == '\x8c\x01\x00\x00\x00\x00\x00\x00' +str(ICMPv6NIReplyRefuse())[:8] == b'\x8c\x01\x00\x00\x00\x00\x00\x00' = ICMPv6NIReplyRefuse - basic dissection -a=ICMPv6NIReplyRefuse('\x8c\x01\x00\x00\x00\x00\x00\x00\xf1\xe9\xab\xc9\x8c\x0by\x18') -a.type == 140 and a.code == 1 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == '\xf1\xe9\xab\xc9\x8c\x0by\x18' and a.data == None +a=ICMPv6NIReplyRefuse(b'\x8c\x01\x00\x00\x00\x00\x00\x00\xf1\xe9\xab\xc9\x8c\x0by\x18') +a.type == 140 and a.code == 1 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == b'\xf1\xe9\xab\xc9\x8c\x0by\x18' and a.data == None ############ @@ -2738,11 +2738,11 @@ a.type == 140 and a.code == 1 and a.cksum == 0 and a.unused == 0 and a.flags == + Test Node Information Query - ICMPv6NIReplyUnknown = ICMPv6NIReplyUnknown - basic instantiation -str(ICMPv6NIReplyUnknown(nonce='\x00'*8)) == '\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(ICMPv6NIReplyUnknown(nonce=b'\x00'*8)) == b'\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = ICMPv6NIReplyRefuse - basic dissection -a=ICMPv6NIReplyRefuse('\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -a.type == 140 and a.code == 2 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == '\x00'*8 and a.data == None +a=ICMPv6NIReplyRefuse(b'\x8c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a.type == 140 and a.code == 2 and a.cksum == 0 and a.unused == 0 and a.flags == 0 and a.nonce == b'\x00'*8 and a.data == None ############ @@ -2758,17 +2758,17 @@ computeNIGroupAddr("scapy") == "ff02::2:f886:2f66" + IPv6ExtHdrFragment Class Test = IPv6ExtHdrFragment - Basic Instantiation -str(IPv6ExtHdrFragment()) == ';\x00\x00\x00\x00\x00\x00\x00' +str(IPv6ExtHdrFragment()) == b';\x00\x00\x00\x00\x00\x00\x00' = IPv6ExtHdrFragment - Instantiation with specific values -str(IPv6ExtHdrFragment(nh=0xff, res1=0xee, offset=0x1fff, res2=1, m=1, id=0x11111111)) == '\xff\xee\xff\xfb\x11\x11\x11\x11' +str(IPv6ExtHdrFragment(nh=0xff, res1=0xee, offset=0x1fff, res2=1, m=1, id=0x11111111)) == b'\xff\xee\xff\xfb\x11\x11\x11\x11' = IPv6ExtHdrFragment - Basic Dissection -a=IPv6ExtHdrFragment(';\x00\x00\x00\x00\x00\x00\x00') +a=IPv6ExtHdrFragment(b';\x00\x00\x00\x00\x00\x00\x00') a.nh == 59 and a.res1 == 0 and a.offset == 0 and a.res2 == 0 and a.m == 0 and a.id == 0 = IPv6ExtHdrFragment - Instantiation with specific values -a=IPv6ExtHdrFragment('\xff\xee\xff\xfb\x11\x11\x11\x11') +a=IPv6ExtHdrFragment(b'\xff\xee\xff\xfb\x11\x11\x11\x11') a.nh == 0xff and a.res1 == 0xee and a.offset==0x1fff and a.res2==1 and a.m == 1 and a.id == 0x11111111 @@ -2787,7 +2787,7 @@ len(l) == 33 and len(str(l[-1])) == 644 = defragment6 - test against a long TCP packet fragmented with a 1280 MTU l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*40000), 1280) -str(defragment6(l)) == ('`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 'A'*40000) +str(defragment6(l)) == (b'`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 'A'*40000) = defragment6 - test against a large TCP packet fragmented with a 1280 bytes MTU and missing fragments @@ -2796,14 +2796,14 @@ del(l[2]) del(l[4]) del(l[12]) del(l[18]) -str(defragment6(l)) == ('`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 2444*'A' + 1232*'X' + 2464*'A' + 1232*'X' + 9856*'A' + 1232*'X' + 7392*'A' + 1232*'X' + 12916*'A') +str(defragment6(l)) == (b'`\x00\x00\x00\x9cT\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xe92\x00\x00' + 2444*'A' + 1232*'X' + 2464*'A' + 1232*'X' + 9856*'A' + 1232*'X' + 7392*'A' + 1232*'X' + 12916*'A') = defragment6 - test against a TCP packet fragmented with a 800 bytes MTU and missing fragments l=fragment6(IPv6()/IPv6ExtHdrFragment()/TCP()/Raw(load="A"*4000), 800) del(l[4]) del(l[2]) -str(defragment6(l)) == '`\x00\x00\x00\x0f\xb4\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xb2\x0f\x00\x00AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +str(defragment6(l)) == b'`\x00\x00\x00\x0f\xb4\x06@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\xb2\x0f\x00\x00AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' ############ @@ -2882,7 +2882,7 @@ answer.answers(query) == True = ICMPv6MLQuery - build & dissection s = str(IPv6()/ICMPv6MLQuery()) -s == "`\x00\x00\x00\x00\x18:\x01\xfe\x80\x00\x00\x00\x00\x00\x00\xba\xca:\xff\xfer\xb0\x8b\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x82\x00\xb4O'\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +s == b"`\x00\x00\x00\x00\x18:\x01\xfe\x80\x00\x00\x00\x00\x00\x00\xba\xca:\xff\xfer\xb0\x8b\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x82\x00\xb4O'\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" p = IPv6(s) ICMPv6MLQuery in p and p[IPv6].dst == "ff02::1" @@ -2970,17 +2970,17 @@ conf.AS_resolver = conf.AS_resolver a=DUID_LLT() = DUID_LLT basic build -str(DUID_LLT()) == '\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DUID_LLT()) == b'\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DUID_LLT build with specific values -str(DUID_LLT(lladdr="ff:ff:ff:ff:ff:ff", timeval=0x11111111, hwtype=0x2222)) == '\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff' +str(DUID_LLT(lladdr="ff:ff:ff:ff:ff:ff", timeval=0x11111111, hwtype=0x2222)) == b'\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff' = DUID_LLT basic dissection a=DUID_LLT(str(DUID_LLT())) a.type == 1 and a.hwtype == 1 and a.timeval == 0 and a.lladdr == "00:00:00:00:00:00" = DUID_LLT dissection with specific values -a=DUID_LLT('\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff') +a=DUID_LLT(b'\x00\x01""\x11\x11\x11\x11\xff\xff\xff\xff\xff\xff') a.type == 1 and a.hwtype == 0x2222 and a.timeval == 0x11111111 and a.lladdr == "ff:ff:ff:ff:ff:ff" @@ -2992,17 +2992,17 @@ a.type == 1 and a.hwtype == 0x2222 and a.timeval == 0x11111111 and a.lladdr == " a=DUID_EN() = DUID_EN basic build -str(DUID_EN()) == '\x00\x02\x00\x00\x017' +str(DUID_EN()) == b'\x00\x02\x00\x00\x017' = DUID_EN build with specific values -str(DUID_EN(enterprisenum=0x11111111, id="iamastring")) == '\x00\x02\x11\x11\x11\x11iamastring' +str(DUID_EN(enterprisenum=0x11111111, id="iamastring")) == b'\x00\x02\x11\x11\x11\x11iamastring' = DUID_EN basic dissection -a=DUID_EN('\x00\x02\x00\x00\x017') +a=DUID_EN(b'\x00\x02\x00\x00\x017') a.type == 2 and a.enterprisenum == 311 = DUID_EN dissection with specific values -a=DUID_EN('\x00\x02\x11\x11\x11\x11iamastring') +a=DUID_EN(b'\x00\x02\x11\x11\x11\x11iamastring') a.type == 2 and a.enterprisenum == 0x11111111 and a.id =="iamastring" @@ -3014,17 +3014,17 @@ a.type == 2 and a.enterprisenum == 0x11111111 and a.id =="iamastring" a=DUID_LL() = DUID_LL basic build -str(DUID_LL()) == '\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' +str(DUID_LL()) == b'\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' = DUID_LL build with specific values -str(DUID_LL(hwtype=1, lladdr="ff:ff:ff:ff:ff:ff")) == '\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff' +str(DUID_LL(hwtype=1, lladdr="ff:ff:ff:ff:ff:ff")) == b'\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff' = DUID_LL basic dissection a=DUID_LL(str(DUID_LL())) a.type == 3 and a.hwtype == 1 and a.lladdr == "00:00:00:00:00:00" = DUID_LL with specific values -a=DUID_LL('\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff') +a=DUID_LL(b'\x00\x03\x00\x01\xff\xff\xff\xff\xff\xff') a.hwtype == 1 and a.lladdr == "ff:ff:ff:ff:ff:ff" @@ -3036,10 +3036,10 @@ a.hwtype == 1 and a.lladdr == "ff:ff:ff:ff:ff:ff" a=DHCP6OptUnknown() = DHCP6 Opt Unknown basic build (default values) -str(DHCP6OptUnknown()) == '\x00\x00\x00\x00' +str(DHCP6OptUnknown()) == b'\x00\x00\x00\x00' = DHCP6 Opt Unknown - len computation test -str(DHCP6OptUnknown(data="shouldbe9")) == '\x00\x00\x00\tshouldbe9' +str(DHCP6OptUnknown(data="shouldbe9")) == b'\x00\x00\x00\tshouldbe9' ############ @@ -3050,48 +3050,48 @@ str(DHCP6OptUnknown(data="shouldbe9")) == '\x00\x00\x00\tshouldbe9' a=DHCP6OptClientId() = DHCP6OptClientId basic build -str(DHCP6OptClientId()) == '\x00\x01\x00\x00' +str(DHCP6OptClientId()) == b'\x00\x01\x00\x00' = DHCP6OptClientId instantiation with specific values -str(DHCP6OptClientId(duid="toto")) == '\x00\x01\x00\x04toto' +str(DHCP6OptClientId(duid="toto")) == b'\x00\x01\x00\x04toto' = DHCP6OptClientId instantiation with DUID_LL -str(DHCP6OptClientId(duid=DUID_LL())) == '\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' +str(DHCP6OptClientId(duid=DUID_LL())) == b'\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' = DHCP6OptClientId instantiation with DUID_LLT -str(DHCP6OptClientId(duid=DUID_LLT())) == '\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptClientId(duid=DUID_LLT())) == b'\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptClientId instantiation with DUID_EN -str(DHCP6OptClientId(duid=DUID_EN())) == '\x00\x01\x00\x06\x00\x02\x00\x00\x017' +str(DHCP6OptClientId(duid=DUID_EN())) == b'\x00\x01\x00\x06\x00\x02\x00\x00\x017' = DHCP6OptClientId instantiation with specified length -str(DHCP6OptClientId(optlen=80, duid="somestring")) == '\x00\x01\x00Psomestring' +str(DHCP6OptClientId(optlen=80, duid="somestring")) == b'\x00\x01\x00Psomestring' = DHCP6OptClientId basic dissection -a=DHCP6OptClientId('\x00\x01\x00\x00') +a=DHCP6OptClientId(b'\x00\x01\x00\x00') a.optcode == 1 and a.optlen == 0 = DHCP6OptClientId instantiation with specified length -str(DHCP6OptClientId(optlen=80, duid="somestring")) == '\x00\x01\x00Psomestring' +str(DHCP6OptClientId(optlen=80, duid="somestring")) == b'\x00\x01\x00Psomestring' = DHCP6OptClientId basic dissection -a=DHCP6OptClientId('\x00\x01\x00\x00') +a=DHCP6OptClientId(b'\x00\x01\x00\x00') a.optcode == 1 and a.optlen == 0 = DHCP6OptClientId dissection with specific duid value -a=DHCP6OptClientId('\x00\x01\x00\x04somestring') +a=DHCP6OptClientId(b'\x00\x01\x00\x04somestring') a.optcode == 1 and a.optlen == 4 and isinstance(a.duid, Raw) and a.duid.load == 'some' and isinstance(a.payload, DHCP6OptUnknown) = DHCP6OptClientId dissection with specific DUID_LL as duid value -a=DHCP6OptClientId('\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00') +a=DHCP6OptClientId(b'\x00\x01\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00') a.optcode == 1 and a.optlen == 10 and isinstance(a.duid, DUID_LL) and a.duid.type == 3 and a.duid.hwtype == 1 and a.duid.lladdr == "00:00:00:00:00:00" = DHCP6OptClientId dissection with specific DUID_LLT as duid value -a=DHCP6OptClientId('\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=DHCP6OptClientId(b'\x00\x01\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 1 and a.optlen == 14 and isinstance(a.duid, DUID_LLT) and a.duid.type == 1 and a.duid.hwtype == 1 and a.duid.timeval == 0 and a.duid.lladdr == "00:00:00:00:00:00" = DHCP6OptClientId dissection with specific DUID_EN as duid value -a=DHCP6OptClientId('\x00\x01\x00\x06\x00\x02\x00\x00\x017') +a=DHCP6OptClientId(b'\x00\x01\x00\x06\x00\x02\x00\x00\x017') a.optcode == 1 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type == 2 and a.duid.enterprisenum == 311 and a.duid.id == "" @@ -3103,41 +3103,41 @@ a.optcode == 1 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type a=DHCP6OptServerId() = DHCP6OptServerId basic build -str(DHCP6OptServerId()) == '\x00\x02\x00\x00' +str(DHCP6OptServerId()) == b'\x00\x02\x00\x00' = DHCP6OptServerId basic build with specific values -str(DHCP6OptServerId(duid="toto")) == '\x00\x02\x00\x04toto' +str(DHCP6OptServerId(duid="toto")) == b'\x00\x02\x00\x04toto' = DHCP6OptServerId instantiation with DUID_LL -str(DHCP6OptServerId(duid=DUID_LL())) == '\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' +str(DHCP6OptServerId(duid=DUID_LL())) == b'\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00' = DHCP6OptServerId instantiation with DUID_LLT -str(DHCP6OptServerId(duid=DUID_LLT())) == '\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptServerId(duid=DUID_LLT())) == b'\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptServerId instantiation with DUID_EN -str(DHCP6OptServerId(duid=DUID_EN())) == '\x00\x02\x00\x06\x00\x02\x00\x00\x017' +str(DHCP6OptServerId(duid=DUID_EN())) == b'\x00\x02\x00\x06\x00\x02\x00\x00\x017' = DHCP6OptServerId instantiation with specified length -str(DHCP6OptServerId(optlen=80, duid="somestring")) == '\x00\x02\x00Psomestring' +str(DHCP6OptServerId(optlen=80, duid="somestring")) == b'\x00\x02\x00Psomestring' = DHCP6OptServerId basic dissection -a=DHCP6OptServerId('\x00\x02\x00\x00') +a=DHCP6OptServerId(b'\x00\x02\x00\x00') a.optcode == 2 and a.optlen == 0 = DHCP6OptServerId dissection with specific duid value -a=DHCP6OptServerId('\x00\x02\x00\x04somestring') +a=DHCP6OptServerId(b'\x00\x02\x00\x04somestring') a.optcode == 2 and a.optlen == 4 and isinstance(a.duid, Raw) and a.duid.load == 'some' and isinstance(a.payload, DHCP6OptUnknown) = DHCP6OptServerId dissection with specific DUID_LL as duid value -a=DHCP6OptServerId('\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00') +a=DHCP6OptServerId(b'\x00\x02\x00\n\x00\x03\x00\x01\x00\x00\x00\x00\x00\x00') a.optcode == 2 and a.optlen == 10 and isinstance(a.duid, DUID_LL) and a.duid.type == 3 and a.duid.hwtype == 1 and a.duid.lladdr == "00:00:00:00:00:00" = DHCP6OptServerId dissection with specific DUID_LLT as duid value -a=DHCP6OptServerId('\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=DHCP6OptServerId(b'\x00\x02\x00\x0e\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 2 and a.optlen == 14 and isinstance(a.duid, DUID_LLT) and a.duid.type == 1 and a.duid.hwtype == 1 and a.duid.timeval == 0 and a.duid.lladdr == "00:00:00:00:00:00" = DHCP6OptServerId dissection with specific DUID_EN as duid value -a=DHCP6OptServerId('\x00\x02\x00\x06\x00\x02\x00\x00\x017') +a=DHCP6OptServerId(b'\x00\x02\x00\x06\x00\x02\x00\x00\x017') a.optcode == 2 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type == 2 and a.duid.enterprisenum == 311 and a.duid.id == "" @@ -3146,20 +3146,20 @@ a.optcode == 2 and a.optlen == 6 and isinstance(a.duid, DUID_EN) and a.duid.type + Test DHCP6 IA Address Option (IA_TA or IA_NA suboption) = DHCP6OptIAAddress - Basic Instantiation -str(DHCP6OptIAAddress()) == '\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIAAddress()) == b'\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptIAAddress - Basic Dissection -a = DHCP6OptIAAddress('\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a = DHCP6OptIAAddress(b'\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 5 and a.optlen == 24 and a.addr == "::" and a.preflft == 0 and a. validlft == 0 and a.iaaddropts == "" = DHCP6OptIAAddress - Instantiation with specific values -str(DHCP6OptIAAddress(optlen=0x1111, addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaaddropts="somestring")) == '\x00\x05\x11\x11""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring' +str(DHCP6OptIAAddress(optlen=0x1111, addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaaddropts="somestring")) == b'\x00\x05\x11\x11""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring' = DHCP6OptIAAddress - Instantiation with specific values (default optlen computation) -str(DHCP6OptIAAddress(addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaaddropts="somestring")) == '\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring' +str(DHCP6OptIAAddress(addr="2222:3333::5555", preflft=0x66666666, validlft=0x77777777, iaaddropts="somestring")) == b'\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring' = DHCP6OptIAAddress - Dissection with specific values -a = DHCP6OptIAAddress('\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring') +a = DHCP6OptIAAddress(b'\x00\x05\x00"""33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00UUffffwwwwsomestring') a.optcode == 5 and a.optlen == 34 and a.addr == "2222:3333::5555" and a.preflft == 0x66666666 and a. validlft == 0x77777777 and a.iaaddropts == "somestring" @@ -3168,23 +3168,23 @@ a.optcode == 5 and a.optlen == 34 and a.addr == "2222:3333::5555" and a.preflft + Test DHCP6 Identity Association for Non-temporary Addresses Option = DHCP6OptIA_NA - Basic Instantiation -str(DHCP6OptIA_NA()) == '\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIA_NA()) == b'\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptIA_NA - Basic Dissection -a = DHCP6OptIA_NA('\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a = DHCP6OptIA_NA(b'\x00\x03\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 3 and a.optlen == 12 and a.iaid == 0 and a.T1 == 0 and a.T2==0 and a.ianaopts == [] = DHCP6OptIA_NA - Instantiation with specific values (keep automatic length computation) -str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == '\x00\x03\x00\x0c""""3333DDDD' +str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == b'\x00\x03\x00\x0c""""3333DDDD' = DHCP6OptIA_NA - Instantiation with specific values (forced optlen) -str(DHCP6OptIA_NA(optlen=0x1111, iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == '\x00\x03\x11\x11""""3333DDDD' +str(DHCP6OptIA_NA(optlen=0x1111, iaid=0x22222222, T1=0x33333333, T2=0x44444444)) == b'\x00\x03\x11\x11""""3333DDDD' = DHCP6OptIA_NA - Instantiation with a list of IA Addresses (optlen automatic computation) -str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444, ianaopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == '\x00\x03\x00D""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIA_NA(iaid=0x22222222, T1=0x33333333, T2=0x44444444, ianaopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == b'\x00\x03\x00D""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptIA_NA - Dissection with specific values -a = DHCP6OptIA_NA('\x00\x03\x00L""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a = DHCP6OptIA_NA(b'\x00\x03\x00L""""3333DDDD\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 3 and a.optlen == 76 and a.iaid == 0x22222222 and a.T1 == 0x33333333 and a.T2==0x44444444 and len(a.ianaopts) == 2 and isinstance(a.ianaopts[0], DHCP6OptIAAddress) and isinstance(a.ianaopts[1], DHCP6OptIAAddress) @@ -3193,17 +3193,17 @@ a.optcode == 3 and a.optlen == 76 and a.iaid == 0x22222222 and a.T1 == 0x3333333 + Test DHCP6 Identity Association for Temporary Addresses Option = DHCP6OptIA_TA - Basic Instantiation -str(DHCP6OptIA_TA()) == '\x00\x04\x00\x04\x00\x00\x00\x00' +str(DHCP6OptIA_TA()) == b'\x00\x04\x00\x04\x00\x00\x00\x00' = DHCP6OptIA_TA - Basic Dissection -a = DHCP6OptIA_TA('\x00\x04\x00\x04\x00\x00\x00\x00') +a = DHCP6OptIA_TA(b'\x00\x04\x00\x04\x00\x00\x00\x00') a.optcode == 4 and a.optlen == 4 and a.iaid == 0 and a.iataopts == [] = DHCP6OptIA_TA - Instantiation with specific values -str(DHCP6OptIA_TA(optlen=0x1111, iaid=0x22222222, iataopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == '\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIA_TA(optlen=0x1111, iaid=0x22222222, iataopts=[DHCP6OptIAAddress(), DHCP6OptIAAddress()])) == b'\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptIA_TA - Dissection with specific values -a = DHCP6OptIA_TA('\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a = DHCP6OptIA_TA(b'\x00\x04\x11\x11""""\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 4 and a.optlen == 0x1111 and a.iaid == 0x22222222 and len(a.iataopts) == 2 and isinstance(a.iataopts[0], DHCP6OptIAAddress) and isinstance(a.iataopts[1], DHCP6OptIAAddress) @@ -3212,20 +3212,20 @@ a.optcode == 4 and a.optlen == 0x1111 and a.iaid == 0x22222222 and len(a.iataopt + Test DHCP6 Option Request Option = DHCP6OptOptReq - Basic Instantiation -str(DHCP6OptOptReq()) == '\x00\x06\x00\x04\x00\x17\x00\x18' +str(DHCP6OptOptReq()) == b'\x00\x06\x00\x04\x00\x17\x00\x18' = DHCP6OptOptReq - optlen field computation -str(DHCP6OptOptReq(reqopts=[1,2,3,4])) == '\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04' +str(DHCP6OptOptReq(reqopts=[1,2,3,4])) == b'\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04' = DHCP6OptOptReq - instantiation with empty list -str(DHCP6OptOptReq(reqopts=[])) == '\x00\x06\x00\x00' +str(DHCP6OptOptReq(reqopts=[])) == b'\x00\x06\x00\x00' = DHCP6OptOptReq - Basic dissection -a=DHCP6OptOptReq('\x00\x06\x00\x00') +a=DHCP6OptOptReq(b'\x00\x06\x00\x00') a.optcode == 6 and a.optlen == 0 and a.reqopts == [23,24] = DHCP6OptOptReq - Dissection with specific value -a=DHCP6OptOptReq('\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04') +a=DHCP6OptOptReq(b'\x00\x06\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04') a.optcode == 6 and a.optlen == 8 and a.reqopts == [1,2,3,4] @@ -3234,17 +3234,17 @@ a.optcode == 6 and a.optlen == 8 and a.reqopts == [1,2,3,4] + Test DHCP6 Option - Preference option = DHCP6OptPref - Basic instantiation -str(DHCP6OptPref()) == '\x00\x07\x00\x01\xff' +str(DHCP6OptPref()) == b'\x00\x07\x00\x01\xff' = DHCP6OptPref - Instantiation with specific values -str(DHCP6OptPref(optlen=0xffff, prefval= 0x11)) == '\x00\x07\xff\xff\x11' +str(DHCP6OptPref(optlen=0xffff, prefval= 0x11)) == b'\x00\x07\xff\xff\x11' = DHCP6OptPref - Basic Dissection -a=DHCP6OptPref('\x00\x07\x00\x01\xff') +a=DHCP6OptPref(b'\x00\x07\x00\x01\xff') a.optcode == 7 and a.optlen == 1 and a.prefval == 255 = DHCP6OptPref - Dissection with specific values -a=DHCP6OptPref('\x00\x07\xff\xff\x11') +a=DHCP6OptPref(b'\x00\x07\xff\xff\x11') a.optcode == 7 and a.optlen == 0xffff and a.prefval == 0x11 @@ -3253,17 +3253,17 @@ a.optcode == 7 and a.optlen == 0xffff and a.prefval == 0x11 + Test DHCP6 Option - Elapsed Time = DHCP6OptElapsedTime - Basic Instantiation -str(DHCP6OptElapsedTime()) == '\x00\x08\x00\x02\x00\x00' +str(DHCP6OptElapsedTime()) == b'\x00\x08\x00\x02\x00\x00' = DHCP6OptElapsedTime - Instantiation with specific elapsedtime value -str(DHCP6OptElapsedTime(elapsedtime=421)) == '\x00\x08\x00\x02\x01\xa5' +str(DHCP6OptElapsedTime(elapsedtime=421)) == b'\x00\x08\x00\x02\x01\xa5' = DHCP6OptElapsedTime - Basic Dissection -a=DHCP6OptElapsedTime('\x00\x08\x00\x02\x00\x00') +a=DHCP6OptElapsedTime(b'\x00\x08\x00\x02\x00\x00') a.optcode == 8 and a.optlen == 2 and a.elapsedtime == 0 = DHCP6OptElapsedTime - Dissection with specific values -a=DHCP6OptElapsedTime('\x00\x08\x00\x02\x01\xa5') +a=DHCP6OptElapsedTime(b'\x00\x08\x00\x02\x01\xa5') a.optcode == 8 and a.optlen == 2 and a.elapsedtime == 421 @@ -3272,24 +3272,24 @@ a.optcode == 8 and a.optlen == 2 and a.elapsedtime == 421 + Test DHCP6 Option - Server Unicast Address = DHCP6OptServerUnicast - Basic Instantiation -str(DHCP6OptServerUnicast()) == '\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptServerUnicast()) == b'\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6OptServerUnicast - Instantiation with specific values (test 1) -str(DHCP6OptServerUnicast(srvaddr="2001::1")) == '\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptServerUnicast(srvaddr="2001::1")) == b'\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptServerUnicast - Instantiation with specific values (test 2) -str(DHCP6OptServerUnicast(srvaddr="2001::1", optlen=42)) == '\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptServerUnicast(srvaddr="2001::1", optlen=42)) == b'\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptServerUnicast - Dissection with default values -a=DHCP6OptServerUnicast('\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=DHCP6OptServerUnicast(b'\x00\x0c\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.optcode == 12 and a.optlen == 16 and a.srvaddr == "::" = DHCP6OptServerUnicast - Dissection with specific values (test 1) -a=DHCP6OptServerUnicast('\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a=DHCP6OptServerUnicast(b'\x00\x0c\x00\x10 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 12 and a.optlen == 16 and a.srvaddr == "2001::1" = DHCP6OptServerUnicast - Dissection with specific values (test 2) -a=DHCP6OptServerUnicast('\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a=DHCP6OptServerUnicast(b'\x00\x0c\x00* \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 12 and a.optlen == 42 and a.srvaddr == "2001::1" @@ -3298,13 +3298,13 @@ a.optcode == 12 and a.optlen == 42 and a.srvaddr == "2001::1" + Test DHCP6 Option - Status Code = DHCP6OptStatusCode - Basic Instantiation -str(DHCP6OptStatusCode()) == '\x00\r\x00\x02\x00\x00' +str(DHCP6OptStatusCode()) == b'\x00\r\x00\x02\x00\x00' = DHCP6OptStatusCode - Instantiation with specific values -str(DHCP6OptStatusCode(optlen=42, statuscode=0xff, statusmsg="Hello")) == '\x00\r\x00*\x00\xffHello' +str(DHCP6OptStatusCode(optlen=42, statuscode=0xff, statusmsg="Hello")) == b'\x00\r\x00*\x00\xffHello' = DHCP6OptStatusCode - Automatic Length computation -str(DHCP6OptStatusCode(statuscode=0xff, statusmsg="Hello")) == '\x00\r\x00\x07\x00\xffHello' +str(DHCP6OptStatusCode(statuscode=0xff, statusmsg="Hello")) == b'\x00\r\x00\x07\x00\xffHello' # Add tests to verify Unicode behavior @@ -3314,10 +3314,10 @@ str(DHCP6OptStatusCode(statuscode=0xff, statusmsg="Hello")) == '\x00\r\x00\x07\x + Test DHCP6 Option - Rapid Commit = DHCP6OptRapidCommit - Basic Instantiation -str(DHCP6OptRapidCommit()) == '\x00\x0e\x00\x00' +str(DHCP6OptRapidCommit()) == b'\x00\x0e\x00\x00' = DHCP6OptRapidCommit - Basic Dissection -a=DHCP6OptRapidCommit('\x00\x0e\x00\x00') +a=DHCP6OptRapidCommit(b'\x00\x0e\x00\x00') a.optcode == 14 and a.optlen == 0 @@ -3326,24 +3326,24 @@ a.optcode == 14 and a.optlen == 0 + Test DHCP6 Option - User class = DHCP6OptUserClass - Basic Instantiation -str(DHCP6OptUserClass()) == '\x00\x0f\x00\x00' +str(DHCP6OptUserClass()) == b'\x00\x0f\x00\x00' = DHCP6OptUserClass - Basic Dissection -a = DHCP6OptUserClass('\x00\x0f\x00\x00') +a = DHCP6OptUserClass(b'\x00\x0f\x00\x00') a.optcode == 15 and a.optlen == 0 and a.userclassdata == [] = DHCP6OptUserClass - Instantiation with one user class data structure -str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something")])) == '\x00\x0f\x00\x0b\x00\tsomething' +str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something")])) == b'\x00\x0f\x00\x0b\x00\tsomething' = DHCP6OptUserClass - Dissection with one user class data structure -a = DHCP6OptUserClass('\x00\x0f\x00\x0b\x00\tsomething') +a = DHCP6OptUserClass(b'\x00\x0f\x00\x0b\x00\tsomething') a.optcode == 15 and a.optlen == 11 and len(a.userclassdata) == 1 and isinstance(a.userclassdata[0], USER_CLASS_DATA) and a.userclassdata[0].len == 9 and a.userclassdata[0].data == 'something' = DHCP6OptUserClass - Instantiation with two user class data structures -str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something"), USER_CLASS_DATA(data="somethingelse")])) == '\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse' +str(DHCP6OptUserClass(userclassdata=[USER_CLASS_DATA(data="something"), USER_CLASS_DATA(data="somethingelse")])) == b'\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse' = DHCP6OptUserClass - Dissection with two user class data structures -a = DHCP6OptUserClass('\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse') +a = DHCP6OptUserClass(b'\x00\x0f\x00\x1a\x00\tsomething\x00\rsomethingelse') a.optcode == 15 and a.optlen == 26 and len(a.userclassdata) == 2 and isinstance(a.userclassdata[0], USER_CLASS_DATA) and isinstance(a.userclassdata[1], USER_CLASS_DATA) and a.userclassdata[0].len == 9 and a.userclassdata[0].data == 'something' and a.userclassdata[1].len == 13 and a.userclassdata[1].data == 'somethingelse' @@ -3352,24 +3352,24 @@ a.optcode == 15 and a.optlen == 26 and len(a.userclassdata) == 2 and isinstance( + Test DHCP6 Option - Vendor class = DHCP6OptVendorClass - Basic Instantiation -str(DHCP6OptVendorClass()) == '\x00\x10\x00\x04\x00\x00\x00\x00' +str(DHCP6OptVendorClass()) == b'\x00\x10\x00\x04\x00\x00\x00\x00' = DHCP6OptVendorClass - Basic Dissection -a = DHCP6OptVendorClass('\x00\x10\x00\x04\x00\x00\x00\x00') +a = DHCP6OptVendorClass(b'\x00\x10\x00\x04\x00\x00\x00\x00') a.optcode == 16 and a.optlen == 4 and a.enterprisenum == 0 and a.vcdata == [] = DHCP6OptVendorClass - Instantiation with one vendor class data structure -str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something")])) == '\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething' +str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something")])) == b'\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething' = DHCP6OptVendorClass - Dissection with one vendor class data structure -a = DHCP6OptVendorClass('\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething') +a = DHCP6OptVendorClass(b'\x00\x10\x00\x0f\x00\x00\x00\x00\x00\tsomething') a.optcode == 16 and a.optlen == 15 and a.enterprisenum == 0 and len(a.vcdata) == 1 and isinstance(a.vcdata[0], VENDOR_CLASS_DATA) and a.vcdata[0].len == 9 and a.vcdata[0].data == 'something' = DHCP6OptVendorClass - Instantiation with two vendor class data structures -str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something"), VENDOR_CLASS_DATA(data="somethingelse")])) == '\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse' +str(DHCP6OptVendorClass(vcdata=[VENDOR_CLASS_DATA(data="something"), VENDOR_CLASS_DATA(data="somethingelse")])) == b'\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse' = DHCP6OptVendorClass - Dissection with two vendor class data structures -a = DHCP6OptVendorClass('\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse') +a = DHCP6OptVendorClass(b'\x00\x10\x00\x1e\x00\x00\x00\x00\x00\tsomething\x00\rsomethingelse') a.optcode == 16 and a.optlen == 30 and a.enterprisenum == 0 and len(a.vcdata) == 2 and isinstance(a.vcdata[0], VENDOR_CLASS_DATA) and isinstance(a.vcdata[1], VENDOR_CLASS_DATA) and a.vcdata[0].len == 9 and a.vcdata[0].data == 'something' and a.vcdata[1].len == 13 and a.vcdata[1].data == 'somethingelse' @@ -3378,24 +3378,24 @@ a.optcode == 16 and a.optlen == 30 and a.enterprisenum == 0 and len(a.vcdata) == + Test DHCP6 Option - Vendor-specific information = DHCP6OptVendorSpecificInfo - Basic Instantiation -str(DHCP6OptVendorSpecificInfo()) == '\x00\x11\x00\x04\x00\x00\x00\x00' +str(DHCP6OptVendorSpecificInfo()) == b'\x00\x11\x00\x04\x00\x00\x00\x00' = DHCP6OptVendorSpecificInfo - Basic Dissection -a = DHCP6OptVendorSpecificInfo('\x00\x11\x00\x04\x00\x00\x00\x00') +a = DHCP6OptVendorSpecificInfo(b'\x00\x11\x00\x04\x00\x00\x00\x00') a.optcode == 17 and a.optlen == 4 and a.enterprisenum == 0 = DHCP6OptVendorSpecificInfo - Instantiation with specific values (one option) -str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something")])) == '\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething' +str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something")])) == b'\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething' = DHCP6OptVendorSpecificInfo - Dissection with with specific values (one option) -a = DHCP6OptVendorSpecificInfo('\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething') +a = DHCP6OptVendorSpecificInfo(b'\x00\x11\x00\x11\xee\xee\xee\xee\x00+\x00\tsomething') a.optcode == 17 and a.optlen == 17 and a.enterprisenum == 0xeeeeeeee and len(a.vso) == 1 and isinstance(a.vso[0], VENDOR_SPECIFIC_OPTION) and a.vso[0].optlen == 9 and a.vso[0].optdata == 'something' = DHCP6OptVendorSpecificInfo - Instantiation with specific values (two options) -str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something"), VENDOR_SPECIFIC_OPTION(optcode=42, optdata="somethingelse")])) == '\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse' +str(DHCP6OptVendorSpecificInfo(enterprisenum=0xeeeeeeee, vso=[VENDOR_SPECIFIC_OPTION(optcode=43, optdata="something"), VENDOR_SPECIFIC_OPTION(optcode=42, optdata="somethingelse")])) == b'\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse' = DHCP6OptVendorSpecificInfo - Dissection with with specific values (two options) -a = DHCP6OptVendorSpecificInfo('\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse') +a = DHCP6OptVendorSpecificInfo(b'\x00\x11\x00"\xee\xee\xee\xee\x00+\x00\tsomething\x00*\x00\rsomethingelse') a.optcode == 17 and a.optlen == 34 and a.enterprisenum == 0xeeeeeeee and len(a.vso) == 2 and isinstance(a.vso[0], VENDOR_SPECIFIC_OPTION) and isinstance(a.vso[1], VENDOR_SPECIFIC_OPTION) and a.vso[0].optlen == 9 and a.vso[0].optdata == 'something' and a.vso[1].optlen == 13 and a.vso[1].optdata == 'somethingelse' @@ -3404,17 +3404,17 @@ a.optcode == 17 and a.optlen == 34 and a.enterprisenum == 0xeeeeeeee and len(a.v + Test DHCP6 Option - Interface-Id = DHCP6OptIfaceId - Basic Instantiation -str(DHCP6OptIfaceId()) == '\x00\x12\x00\x00' +str(DHCP6OptIfaceId()) == b'\x00\x12\x00\x00' = DHCP6OptIfaceId - Basic Dissection -a = DHCP6OptIfaceId('\x00\x12\x00\x00') +a = DHCP6OptIfaceId(b'\x00\x12\x00\x00') a.optcode == 18 and a.optlen == 0 = DHCP6OptIfaceId - Instantiation with specific value -str(DHCP6OptIfaceId(ifaceid="something")) == '\x00\x12\x00\x09something' +str(DHCP6OptIfaceId(ifaceid="something")) == b'\x00\x12\x00\x09something' = DHCP6OptIfaceId - Dissection with specific value -a = DHCP6OptIfaceId('\x00\x12\x00\x09something') +a = DHCP6OptIfaceId(b'\x00\x12\x00\x09something') a.optcode == 18 and a.optlen == 9 and a.ifaceid == "something" @@ -3423,17 +3423,17 @@ a.optcode == 18 and a.optlen == 9 and a.ifaceid == "something" + Test DHCP6 Option - Reconfigure Message = DHCP6OptReconfMsg - Basic Instantiation -str(DHCP6OptReconfMsg()) == '\x00\x13\x00\x01\x0b' +str(DHCP6OptReconfMsg()) == b'\x00\x13\x00\x01\x0b' = DHCP6OptReconfMsg - Basic Dissection -a = DHCP6OptReconfMsg('\x00\x13\x00\x01\x0b') +a = DHCP6OptReconfMsg(b'\x00\x13\x00\x01\x0b') a.optcode == 19 and a.optlen == 1 and a.msgtype == 11 = DHCP6OptReconfMsg - Instantiation with specific values -str(DHCP6OptReconfMsg(optlen=4, msgtype=5)) == '\x00\x13\x00\x04\x05' +str(DHCP6OptReconfMsg(optlen=4, msgtype=5)) == b'\x00\x13\x00\x04\x05' = DHCP6OptReconfMsg - Dissection with specific values -a = DHCP6OptReconfMsg('\x00\x13\x00\x04\x05') +a = DHCP6OptReconfMsg(b'\x00\x13\x00\x04\x05') a.optcode == 19 and a.optlen == 4 and a.msgtype == 5 @@ -3442,17 +3442,17 @@ a.optcode == 19 and a.optlen == 4 and a.msgtype == 5 + Test DHCP6 Option - Reconfigure Accept = DHCP6OptReconfAccept - Basic Instantiation -str(DHCP6OptReconfAccept()) == '\x00\x14\x00\x00' +str(DHCP6OptReconfAccept()) == b'\x00\x14\x00\x00' = DHCP6OptReconfAccept - Basic Dissection -a = DHCP6OptReconfAccept('\x00\x14\x00\x00') +a = DHCP6OptReconfAccept(b'\x00\x14\x00\x00') a.optcode == 20 and a.optlen == 0 = DHCP6OptReconfAccept - Instantiation with specific values -str(DHCP6OptReconfAccept(optlen=23)) == '\x00\x14\x00\x17' +str(DHCP6OptReconfAccept(optlen=23)) == b'\x00\x14\x00\x17' = DHCP6OptReconfAccept - Dssection with specific values -a = DHCP6OptReconfAccept('\x00\x14\x00\x17') +a = DHCP6OptReconfAccept(b'\x00\x14\x00\x17') a.optcode == 20 and a.optlen == 23 @@ -3461,28 +3461,28 @@ a.optcode == 20 and a.optlen == 23 + Test DHCP6 Option - SIP Servers Domain Name List = DHCP6OptSIPDomains - Basic Instantiation -str(DHCP6OptSIPDomains()) == '\x00\x15\x00\x00' +str(DHCP6OptSIPDomains()) == b'\x00\x15\x00\x00' = DHCP6OptSIPDomains - Basic Dissection -a = DHCP6OptSIPDomains('\x00\x15\x00\x00') +a = DHCP6OptSIPDomains(b'\x00\x15\x00\x00') a.optcode == 21 and a.optlen == 0 and a.sipdomains == [] = DHCP6OptSIPDomains - Instantiation with one domain -str(DHCP6OptSIPDomains(sipdomains=["toto.example.org"])) == '\x00\x15\x00\x12\x04toto\x07example\x03org\x00' +str(DHCP6OptSIPDomains(sipdomains=["toto.example.org"])) == b'\x00\x15\x00\x12\x04toto\x07example\x03org\x00' = DHCP6OptSIPDomains - Dissection with one domain -a = DHCP6OptSIPDomains('\x00\x15\x00\x12\x04toto\x07example\x03org\x00') +a = DHCP6OptSIPDomains(b'\x00\x15\x00\x12\x04toto\x07example\x03org\x00') a.optcode == 21 and a.optlen == 18 and len(a.sipdomains) == 1 and a.sipdomains[0] == "toto.example.org." = DHCP6OptSIPDomains - Instantiation with two domains -str(DHCP6OptSIPDomains(sipdomains=["toto.example.org", "titi.example.org"])) == '\x00\x15\x00$\x04toto\x07example\x03org\x00\x04titi\x07example\x03org\x00' +str(DHCP6OptSIPDomains(sipdomains=["toto.example.org", "titi.example.org"])) == b'\x00\x15\x00$\x04toto\x07example\x03org\x00\x04titi\x07example\x03org\x00' = DHCP6OptSIPDomains - Dissection with two domains -a = DHCP6OptSIPDomains('\x00\x15\x00$\x04toto\x07example\x03org\x00\x04TITI\x07example\x03org\x00') +a = DHCP6OptSIPDomains(b'\x00\x15\x00$\x04toto\x07example\x03org\x00\x04TITI\x07example\x03org\x00') a.optcode == 21 and a.optlen == 36 and len(a.sipdomains) == 2 and a.sipdomains[0] == "toto.example.org." and a.sipdomains[1] == "TITI.example.org." = DHCP6OptSIPDomains - Enforcing only one dot at end of domain -str(DHCP6OptSIPDomains(sipdomains=["toto.example.org."])) == '\x00\x15\x00\x12\x04toto\x07example\x03org\x00' +str(DHCP6OptSIPDomains(sipdomains=["toto.example.org."])) == b'\x00\x15\x00\x12\x04toto\x07example\x03org\x00' ############ @@ -3490,24 +3490,24 @@ str(DHCP6OptSIPDomains(sipdomains=["toto.example.org."])) == '\x00\x15\x00\x12\x + Test DHCP6 Option - SIP Servers IPv6 Address List = DHCP6OptSIPServers - Basic Instantiation -str(DHCP6OptSIPServers()) == '\x00\x16\x00\x00' +str(DHCP6OptSIPServers()) == b'\x00\x16\x00\x00' = DHCP6OptSIPServers - Basic Dissection -a = DHCP6OptSIPServers('\x00\x16\x00\x00') +a = DHCP6OptSIPServers(b'\x00\x16\x00\x00') a.optcode == 22 and a. optlen == 0 and a.sipservers == [] = DHCP6OptSIPServers - Instantiation with specific values (1 address) -str(DHCP6OptSIPServers(sipservers = ["2001:db8::1"] )) == '\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptSIPServers(sipservers = ["2001:db8::1"] )) == b'\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptSIPServers - Dissection with specific values (1 address) -a = DHCP6OptSIPServers('\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptSIPServers(b'\x00\x16\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 22 and a.optlen == 16 and len(a.sipservers) == 1 and a.sipservers[0] == "2001:db8::1" = DHCP6OptSIPServers - Instantiation with specific values (2 addresses) -str(DHCP6OptSIPServers(sipservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptSIPServers(sipservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptSIPServers - Dissection with specific values (2 addresses) -a = DHCP6OptSIPServers('\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptSIPServers(b'\x00\x16\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 22 and a.optlen == 32 and len(a.sipservers) == 2 and a.sipservers[0] == "2001:db8::1" and a.sipservers[1] == "2001:db8::2" @@ -3516,24 +3516,24 @@ a.optcode == 22 and a.optlen == 32 and len(a.sipservers) == 2 and a.sipservers[0 + Test DHCP6 Option - DNS Recursive Name Server = DHCP6OptDNSServers - Basic Instantiation -str(DHCP6OptDNSServers()) == '\x00\x17\x00\x00' +str(DHCP6OptDNSServers()) == b'\x00\x17\x00\x00' = DHCP6OptDNSServers - Basic Dissection -a = DHCP6OptDNSServers('\x00\x17\x00\x00') +a = DHCP6OptDNSServers(b'\x00\x17\x00\x00') a.optcode == 23 and a. optlen == 0 and a.dnsservers == [] = DHCP6OptDNSServers - Instantiation with specific values (1 address) -str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1"] )) == '\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1"] )) == b'\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptDNSServers - Dissection with specific values (1 address) -a = DHCP6OptDNSServers('\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptDNSServers(b'\x00\x17\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 23 and a.optlen == 16 and len(a.dnsservers) == 1 and a.dnsservers[0] == "2001:db8::1" = DHCP6OptDNSServers - Instantiation with specific values (2 addresses) -str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptDNSServers(dnsservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptDNSServers - Dissection with specific values (2 addresses) -a = DHCP6OptDNSServers('\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptDNSServers(b'\x00\x17\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 23 and a.optlen == 32 and len(a.dnsservers) == 2 and a.dnsservers[0] == "2001:db8::1" and a.dnsservers[1] == "2001:db8::2" @@ -3542,24 +3542,24 @@ a.optcode == 23 and a.optlen == 32 and len(a.dnsservers) == 2 and a.dnsservers[0 + Test DHCP6 Option - DNS Domain Search List Option = DHCP6OptDNSDomains - Basic Instantiation -str(DHCP6OptDNSDomains()) == '\x00\x18\x00\x00' +str(DHCP6OptDNSDomains()) == b'\x00\x18\x00\x00' = DHCP6OptDNSDomains - Basic Dissection -a = DHCP6OptDNSDomains('\x00\x18\x00\x00') +a = DHCP6OptDNSDomains(b'\x00\x18\x00\x00') a.optcode == 24 and a.optlen == 0 and a.dnsdomains == [] = DHCP6OptDNSDomains - Instantiation with specific values (1 domain) -str(DHCP6OptDNSDomains(dnsdomains=["toto.example.com."])) == '\x00\x18\x00\x12\x04toto\x07example\x03com\x00' +str(DHCP6OptDNSDomains(dnsdomains=["toto.example.com."])) == b'\x00\x18\x00\x12\x04toto\x07example\x03com\x00' = DHCP6OptDNSDomains - Dissection with specific values (1 domain) -a = DHCP6OptDNSDomains('\x00\x18\x00\x12\x04toto\x07example\x03com\x00') +a = DHCP6OptDNSDomains(b'\x00\x18\x00\x12\x04toto\x07example\x03com\x00') a.optcode == 24 and a.optlen == 18 and len(a.dnsdomains) == 1 and a.dnsdomains[0] == "toto.example.com." = DHCP6OptDNSDomains - Instantiation with specific values (2 domains) -str(DHCP6OptDNSDomains(dnsdomains=["toto.example.com.", "titi.example.com."])) == '\x00\x18\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00' +str(DHCP6OptDNSDomains(dnsdomains=["toto.example.com.", "titi.example.com."])) == b'\x00\x18\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00' = DHCP6OptDNSDomains - Dissection with specific values (2 domains) -a = DHCP6OptDNSDomains('\x00\x18\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00') +a = DHCP6OptDNSDomains(b'\x00\x18\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00') a.optcode == 24 and a.optlen == 36 and len(a.dnsdomains) == 2 and a.dnsdomains[0] == "toto.example.com." and a.dnsdomains[1] == "titi.example.com." @@ -3568,7 +3568,7 @@ a.optcode == 24 and a.optlen == 36 and len(a.dnsdomains) == 2 and a.dnsdomains[0 + Test DHCP6 Option - IA_PD Prefix Option = DHCP6OptIAPrefix - Basic Instantiation -str(DHCP6OptIAPrefix()) == '\x00\x1a\x00\x19\x00\x00\x00\x00\x00\x00\x00\x000 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIAPrefix()) == b'\x00\x1a\x00\x19\x00\x00\x00\x00\x00\x00\x00\x000 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' #TODO : finish me @@ -3578,7 +3578,7 @@ str(DHCP6OptIAPrefix()) == '\x00\x1a\x00\x19\x00\x00\x00\x00\x00\x00\x00\x000 \x + Test DHCP6 Option - Identity Association for Prefix Delegation = DHCP6OptIA_PD - Basic Instantiation -str(DHCP6OptIA_PD()) == '\x00\x19\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6OptIA_PD()) == b'\x00\x19\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' #TODO : finish me @@ -3588,24 +3588,24 @@ str(DHCP6OptIA_PD()) == '\x00\x19\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 + Test DHCP6 Option - NIS Servers = DHCP6OptNISServers - Basic Instantiation -str(DHCP6OptNISServers()) == '\x00\x1b\x00\x00' +str(DHCP6OptNISServers()) == b'\x00\x1b\x00\x00' = DHCP6OptNISServers - Basic Dissection -a = DHCP6OptNISServers('\x00\x1b\x00\x00') +a = DHCP6OptNISServers(b'\x00\x1b\x00\x00') a.optcode == 27 and a. optlen == 0 and a.nisservers == [] = DHCP6OptNISServers - Instantiation with specific values (1 address) -str(DHCP6OptNISServers(nisservers = ["2001:db8::1"] )) == '\x00\x1b\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptNISServers(nisservers = ["2001:db8::1"] )) == b'\x00\x1b\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptNISServers - Dissection with specific values (1 address) -a = DHCP6OptNISServers('\x00\x1b\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptNISServers(b'\x00\x1b\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 27 and a.optlen == 16 and len(a.nisservers) == 1 and a.nisservers[0] == "2001:db8::1" = DHCP6OptNISServers - Instantiation with specific values (2 addresses) -str(DHCP6OptNISServers(nisservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x1b\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptNISServers(nisservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00\x1b\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptNISServers - Dissection with specific values (2 addresses) -a = DHCP6OptNISServers('\x00\x1b\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptNISServers(b'\x00\x1b\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 27 and a.optlen == 32 and len(a.nisservers) == 2 and a.nisservers[0] == "2001:db8::1" and a.nisservers[1] == "2001:db8::2" @@ -3614,24 +3614,24 @@ a.optcode == 27 and a.optlen == 32 and len(a.nisservers) == 2 and a.nisservers[0 + Test DHCP6 Option - NIS+ Servers = DHCP6OptNISPServers - Basic Instantiation -str(DHCP6OptNISPServers()) == '\x00\x1c\x00\x00' +str(DHCP6OptNISPServers()) == b'\x00\x1c\x00\x00' = DHCP6OptNISPServers - Basic Dissection -a = DHCP6OptNISPServers('\x00\x1c\x00\x00') +a = DHCP6OptNISPServers(b'\x00\x1c\x00\x00') a.optcode == 28 and a. optlen == 0 and a.nispservers == [] = DHCP6OptNISPServers - Instantiation with specific values (1 address) -str(DHCP6OptNISPServers(nispservers = ["2001:db8::1"] )) == '\x00\x1c\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptNISPServers(nispservers = ["2001:db8::1"] )) == b'\x00\x1c\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptNISPServers - Dissection with specific values (1 address) -a = DHCP6OptNISPServers('\x00\x1c\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptNISPServers(b'\x00\x1c\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 28 and a.optlen == 16 and len(a.nispservers) == 1 and a.nispservers[0] == "2001:db8::1" = DHCP6OptNISPServers - Instantiation with specific values (2 addresses) -str(DHCP6OptNISPServers(nispservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x1c\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptNISPServers(nispservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00\x1c\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptNISPServers - Dissection with specific values (2 addresses) -a = DHCP6OptNISPServers('\x00\x1c\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptNISPServers(b'\x00\x1c\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 28 and a.optlen == 32 and len(a.nispservers) == 2 and a.nispservers[0] == "2001:db8::1" and a.nispservers[1] == "2001:db8::2" @@ -3640,21 +3640,21 @@ a.optcode == 28 and a.optlen == 32 and len(a.nispservers) == 2 and a.nispservers + Test DHCP6 Option - NIS Domain Name = DHCP6OptNISDomain - Basic Instantiation -str(DHCP6OptNISDomain()) == '\x00\x1d\x00\x00' +str(DHCP6OptNISDomain()) == b'\x00\x1d\x00\x00' = DHCP6OptNISDomain - Basic Dissection -a = DHCP6OptNISDomain('\x00\x1d\x00\x00') +a = DHCP6OptNISDomain(b'\x00\x1d\x00\x00') a.optcode == 29 and a.optlen == 0 and a.nisdomain == "" = DHCP6OptNISDomain - Instantiation with one domain name -str(DHCP6OptNISDomain(nisdomain="toto.example.org")) == '\x00\x1d\x00\x11\x04toto\x07example\x03org' +str(DHCP6OptNISDomain(nisdomain="toto.example.org")) == b'\x00\x1d\x00\x11\x04toto\x07example\x03org' = DHCP6OptNISDomain - Dissection with one domain name -a = DHCP6OptNISDomain('\x00\x1d\x00\x11\x04toto\x07example\x03org\x00') +a = DHCP6OptNISDomain(b'\x00\x1d\x00\x11\x04toto\x07example\x03org\x00') a.optcode == 29 and a.optlen == 17 and a.nisdomain == "toto.example.org" = DHCP6OptNISDomain - Instantiation with one domain with trailing dot -str(DHCP6OptNISDomain(nisdomain="toto.example.org.")) == '\x00\x1d\x00\x12\x04toto\x07example\x03org\x00' +str(DHCP6OptNISDomain(nisdomain="toto.example.org.")) == b'\x00\x1d\x00\x12\x04toto\x07example\x03org\x00' ############ @@ -3662,21 +3662,21 @@ str(DHCP6OptNISDomain(nisdomain="toto.example.org.")) == '\x00\x1d\x00\x12\x04to + Test DHCP6 Option - NIS+ Domain Name = DHCP6OptNISPDomain - Basic Instantiation -str(DHCP6OptNISPDomain()) == '\x00\x1e\x00\x00' +str(DHCP6OptNISPDomain()) == b'\x00\x1e\x00\x00' = DHCP6OptNISPDomain - Basic Dissection -a = DHCP6OptNISPDomain('\x00\x1e\x00\x00') +a = DHCP6OptNISPDomain(b'\x00\x1e\x00\x00') a.optcode == 30 and a.optlen == 0 and a.nispdomain == "" = DHCP6OptNISPDomain - Instantiation with one domain name -str(DHCP6OptNISPDomain(nispdomain="toto.example.org")) == '\x00\x1e\x00\x11\x04toto\x07example\x03org' +str(DHCP6OptNISPDomain(nispdomain="toto.example.org")) == b'\x00\x1e\x00\x11\x04toto\x07example\x03org' = DHCP6OptNISPDomain - Dissection with one domain name -a = DHCP6OptNISPDomain('\x00\x1e\x00\x11\x04toto\x07example\x03org\x00') +a = DHCP6OptNISPDomain(b'\x00\x1e\x00\x11\x04toto\x07example\x03org\x00') a.optcode == 30 and a.optlen == 17 and a.nispdomain == "toto.example.org" = DHCP6OptNISPDomain - Instantiation with one domain with trailing dot -str(DHCP6OptNISPDomain(nispdomain="toto.example.org.")) == '\x00\x1e\x00\x12\x04toto\x07example\x03org\x00' +str(DHCP6OptNISPDomain(nispdomain="toto.example.org.")) == b'\x00\x1e\x00\x12\x04toto\x07example\x03org\x00' ############ @@ -3684,24 +3684,24 @@ str(DHCP6OptNISPDomain(nispdomain="toto.example.org.")) == '\x00\x1e\x00\x12\x04 + Test DHCP6 Option - SNTP Servers = DHCP6OptSNTPServers - Basic Instantiation -str(DHCP6OptSNTPServers()) == '\x00\x1f\x00\x00' +str(DHCP6OptSNTPServers()) == b'\x00\x1f\x00\x00' = DHCP6OptSNTPServers - Basic Dissection -a = DHCP6OptSNTPServers('\x00\x1f\x00\x00') +a = DHCP6OptSNTPServers(b'\x00\x1f\x00\x00') a.optcode == 31 and a. optlen == 0 and a.sntpservers == [] = DHCP6OptSNTPServers - Instantiation with specific values (1 address) -str(DHCP6OptSNTPServers(sntpservers = ["2001:db8::1"] )) == '\x00\x1f\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptSNTPServers(sntpservers = ["2001:db8::1"] )) == b'\x00\x1f\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptSNTPServers - Dissection with specific values (1 address) -a = DHCP6OptSNTPServers('\x00\x1f\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptSNTPServers(b'\x00\x1f\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 31 and a.optlen == 16 and len(a.sntpservers) == 1 and a.sntpservers[0] == "2001:db8::1" = DHCP6OptSNTPServers - Instantiation with specific values (2 addresses) -str(DHCP6OptSNTPServers(sntpservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00\x1f\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptSNTPServers(sntpservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00\x1f\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptSNTPServers - Dissection with specific values (2 addresses) -a = DHCP6OptSNTPServers('\x00\x1f\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptSNTPServers(b'\x00\x1f\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 31 and a.optlen == 32 and len(a.sntpservers) == 2 and a.sntpservers[0] == "2001:db8::1" and a.sntpservers[1] == "2001:db8::2" ############ @@ -3709,38 +3709,38 @@ a.optcode == 31 and a.optlen == 32 and len(a.sntpservers) == 2 and a.sntpservers + Test DHCP6 Option - Information Refresh Time = DHCP6OptInfoRefreshTime - Basic Instantiation -str(DHCP6OptInfoRefreshTime()) == '\x00 \x00\x04\x00\x01Q\x80' +str(DHCP6OptInfoRefreshTime()) == b'\x00 \x00\x04\x00\x01Q\x80' = DHCP6OptInfoRefreshTime - Basic Dissction -a = DHCP6OptInfoRefreshTime('\x00 \x00\x04\x00\x01Q\x80') +a = DHCP6OptInfoRefreshTime(b'\x00 \x00\x04\x00\x01Q\x80') a.optcode == 32 and a.optlen == 4 and a.reftime == 86400 = DHCP6OptInfoRefreshTime - Instantiation with specific values -str(DHCP6OptInfoRefreshTime(optlen=7, reftime=42)) == '\x00 \x00\x07\x00\x00\x00*' +str(DHCP6OptInfoRefreshTime(optlen=7, reftime=42)) == b'\x00 \x00\x07\x00\x00\x00*' ############ ############ + Test DHCP6 Option - BCMCS Servers = DHCP6OptBCMCSServers - Basic Instantiation -str(DHCP6OptBCMCSServers()) == '\x00"\x00\x00' +str(DHCP6OptBCMCSServers()) == b'\x00"\x00\x00' = DHCP6OptBCMCSServers - Basic Dissection -a = DHCP6OptBCMCSServers('\x00"\x00\x00') +a = DHCP6OptBCMCSServers(b'\x00"\x00\x00') a.optcode == 34 and a. optlen == 0 and a.bcmcsservers == [] = DHCP6OptBCMCSServers - Instantiation with specific values (1 address) -str(DHCP6OptBCMCSServers(bcmcsservers = ["2001:db8::1"] )) == '\x00"\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +str(DHCP6OptBCMCSServers(bcmcsservers = ["2001:db8::1"] )) == b'\x00"\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' = DHCP6OptBCMCSServers - Dissection with specific values (1 address) -a = DHCP6OptBCMCSServers('\x00"\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') +a = DHCP6OptBCMCSServers(b'\x00"\x00\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') a.optcode == 34 and a.optlen == 16 and len(a.bcmcsservers) == 1 and a.bcmcsservers[0] == "2001:db8::1" = DHCP6OptBCMCSServers - Instantiation with specific values (2 addresses) -str(DHCP6OptBCMCSServers(bcmcsservers = ["2001:db8::1", "2001:db8::2"] )) == '\x00"\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +str(DHCP6OptBCMCSServers(bcmcsservers = ["2001:db8::1", "2001:db8::2"] )) == b'\x00"\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' = DHCP6OptBCMCSServers - Dissection with specific values (2 addresses) -a = DHCP6OptBCMCSServers('\x00"\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') +a = DHCP6OptBCMCSServers(b'\x00"\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02') a.optcode == 34 and a.optlen == 32 and len(a.bcmcsservers) == 2 and a.bcmcsservers[0] == "2001:db8::1" and a.bcmcsservers[1] == "2001:db8::2" @@ -3749,24 +3749,24 @@ a.optcode == 34 and a.optlen == 32 and len(a.bcmcsservers) == 2 and a.bcmcsserve + Test DHCP6 Option - BCMCS Domains = DHCP6OptBCMCSDomains - Basic Instantiation -str(DHCP6OptBCMCSDomains()) == '\x00!\x00\x00' +str(DHCP6OptBCMCSDomains()) == b'\x00!\x00\x00' = DHCP6OptBCMCSDomains - Basic Dissection -a = DHCP6OptBCMCSDomains('\x00!\x00\x00') +a = DHCP6OptBCMCSDomains(b'\x00!\x00\x00') a.optcode == 33 and a.optlen == 0 and a.bcmcsdomains == [] = DHCP6OptBCMCSDomains - Instantiation with specific values (1 domain) -str(DHCP6OptBCMCSDomains(bcmcsdomains=["toto.example.com."])) == '\x00!\x00\x12\x04toto\x07example\x03com\x00' +str(DHCP6OptBCMCSDomains(bcmcsdomains=["toto.example.com."])) == b'\x00!\x00\x12\x04toto\x07example\x03com\x00' = DHCP6OptBCMCSDomains - Dissection with specific values (1 domain) -a = DHCP6OptBCMCSDomains('\x00!\x00\x12\x04toto\x07example\x03com\x00') +a = DHCP6OptBCMCSDomains(b'\x00!\x00\x12\x04toto\x07example\x03com\x00') a.optcode == 33 and a.optlen == 18 and len(a.bcmcsdomains) == 1 and a.bcmcsdomains[0] == "toto.example.com." = DHCP6OptBCMCSDomains - Instantiation with specific values (2 domains) -str(DHCP6OptBCMCSDomains(bcmcsdomains=["toto.example.com.", "titi.example.com."])) == '\x00!\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00' +str(DHCP6OptBCMCSDomains(bcmcsdomains=["toto.example.com.", "titi.example.com."])) == b'\x00!\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00' = DHCP6OptBCMCSDomains - Dissection with specific values (2 domains) -a = DHCP6OptBCMCSDomains('\x00!\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00') +a = DHCP6OptBCMCSDomains(b'\x00!\x00$\x04toto\x07example\x03com\x00\x04titi\x07example\x03com\x00') a.optcode == 33 and a.optlen == 36 and len(a.bcmcsdomains) == 2 and a.bcmcsdomains[0] == "toto.example.com." and a.bcmcsdomains[1] == "titi.example.com." @@ -3775,17 +3775,17 @@ a.optcode == 33 and a.optlen == 36 and len(a.bcmcsdomains) == 2 and a.bcmcsdomai + Test DHCP6 Option - Relay Agent Remote-ID = DHCP6OptRemoteID - Basic Instantiation -str(DHCP6OptRemoteID()) == '\x00%\x00\x04\x00\x00\x00\x00' +str(DHCP6OptRemoteID()) == b'\x00%\x00\x04\x00\x00\x00\x00' = DHCP6OptRemoteID - Basic Dissection -a = DHCP6OptRemoteID('\x00%\x00\x04\x00\x00\x00\x00') +a = DHCP6OptRemoteID(b'\x00%\x00\x04\x00\x00\x00\x00') a.optcode == 37 and a.optlen == 4 and a.enterprisenum == 0 and a.remoteid == "" = DHCP6OptRemoteID - Instantiation with specific values -str(DHCP6OptRemoteID(enterprisenum=0xeeeeeeee, remoteid="someid")) == '\x00%\x00\n\xee\xee\xee\xeesomeid' +str(DHCP6OptRemoteID(enterprisenum=0xeeeeeeee, remoteid="someid")) == b'\x00%\x00\n\xee\xee\xee\xeesomeid' = DHCP6OptRemoteID - Dissection with specific values -a = DHCP6OptRemoteID('\x00%\x00\n\xee\xee\xee\xeesomeid') +a = DHCP6OptRemoteID(b'\x00%\x00\n\xee\xee\xee\xeesomeid') a.optcode == 37 and a.optlen == 10 and a.enterprisenum == 0xeeeeeeee and a.remoteid == "someid" @@ -3794,17 +3794,17 @@ a.optcode == 37 and a.optlen == 10 and a.enterprisenum == 0xeeeeeeee and a.remot + Test DHCP6 Option - Subscriber ID = DHCP6OptSubscriberID - Basic Instantiation -str(DHCP6OptSubscriberID()) == '\x00&\x00\x00' +str(DHCP6OptSubscriberID()) == b'\x00&\x00\x00' = DHCP6OptSubscriberID - Basic Dissection -a = DHCP6OptSubscriberID('\x00&\x00\x00') +a = DHCP6OptSubscriberID(b'\x00&\x00\x00') a.optcode == 38 and a.optlen == 0 and a.subscriberid == "" = DHCP6OptSubscriberID - Instantiation with specific values -str(DHCP6OptSubscriberID(subscriberid="someid")) == '\x00&\x00\x06someid' +str(DHCP6OptSubscriberID(subscriberid="someid")) == b'\x00&\x00\x06someid' = DHCP6OptSubscriberID - Dissection with specific values -a = DHCP6OptSubscriberID('\x00&\x00\x06someid') +a = DHCP6OptSubscriberID(b'\x00&\x00\x06someid') a.optcode == 38 and a.optlen == 6 and a.subscriberid == "someid" @@ -3813,20 +3813,20 @@ a.optcode == 38 and a.optlen == 6 and a.subscriberid == "someid" + Test DHCP6 Option - Client FQDN = DHCP6OptClientFQDN - Basic Instantiation -str(DHCP6OptClientFQDN()) == "\x00'\x00\x01\x00" +str(DHCP6OptClientFQDN()) == b"\x00'\x00\x01\x00" = DHCP6OptClientFQDN - Basic Dissection -a = DHCP6OptClientFQDN("\x00'\x00\x01\x00") +a = DHCP6OptClientFQDN(b"\x00'\x00\x01\x00") a.optcode == 39 and a.optlen == 1 and a.res == 0 and a.flags == 0 and a.fqdn == "" = DHCP6OptClientFQDN - Instantiation with various flags combinations -str(DHCP6OptClientFQDN(flags="S")) == "\x00'\x00\x01\x01" and str(DHCP6OptClientFQDN(flags="O")) == "\x00'\x00\x01\x02" and str(DHCP6OptClientFQDN(flags="N")) == "\x00'\x00\x01\x04" and str(DHCP6OptClientFQDN(flags="SON")) == "\x00'\x00\x01\x07" and str(DHCP6OptClientFQDN(flags="ON")) == "\x00'\x00\x01\x06" +str(DHCP6OptClientFQDN(flags="S")) == b"\x00'\x00\x01\x01" and str(DHCP6OptClientFQDN(flags="O")) == b"\x00'\x00\x01\x02" and str(DHCP6OptClientFQDN(flags="N")) == b"\x00'\x00\x01\x04" and str(DHCP6OptClientFQDN(flags="SON")) == b"\x00'\x00\x01\x07" and str(DHCP6OptClientFQDN(flags="ON")) == b"\x00'\x00\x01\x06" = DHCP6OptClientFQDN - Instantiation with one fqdn -str(DHCP6OptClientFQDN(fqdn="toto.example.org")) == "\x00'\x00\x12\x00\x04toto\x07example\x03org" +str(DHCP6OptClientFQDN(fqdn="toto.example.org")) == b"\x00'\x00\x12\x00\x04toto\x07example\x03org" = DHCP6OptClientFQDN - Dissection with one fqdn -a = DHCP6OptClientFQDN("\x00'\x00\x12\x00\x04toto\x07example\x03org\x00") +a = DHCP6OptClientFQDN(b"\x00'\x00\x12\x00\x04toto\x07example\x03org\x00") a.optcode == 39 and a.optlen == 18 and a.res == 0 and a.flags == 0 and a.fqdn == "toto.example.org" @@ -3835,20 +3835,20 @@ a.optcode == 39 and a.optlen == 18 and a.res == 0 and a.flags == 0 and a.fqdn == + Test DHCP6 Option Relay Agent Echo Request Option = DHCP6OptRelayAgentERO - Basic Instantiation -str(DHCP6OptRelayAgentERO()) == '\x00+\x00\x04\x00\x17\x00\x18' +str(DHCP6OptRelayAgentERO()) == b'\x00+\x00\x04\x00\x17\x00\x18' = DHCP6OptRelayAgentERO - optlen field computation -str(DHCP6OptRelayAgentERO(reqopts=[1,2,3,4])) == '\x00+\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04' +str(DHCP6OptRelayAgentERO(reqopts=[1,2,3,4])) == b'\x00+\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04' = DHCP6OptRelayAgentERO - instantiation with empty list -str(DHCP6OptRelayAgentERO(reqopts=[])) == '\x00+\x00\x00' +str(DHCP6OptRelayAgentERO(reqopts=[])) == b'\x00+\x00\x00' = DHCP6OptRelayAgentERO - Basic dissection -a=DHCP6OptRelayAgentERO('\x00+\x00\x00') +a=DHCP6OptRelayAgentERO(b'\x00+\x00\x00') a.optcode == 43 and a.optlen == 0 and a.reqopts == [23,24] = DHCP6OptRelayAgentERO - Dissection with specific value -a=DHCP6OptRelayAgentERO('\x00+\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04') +a=DHCP6OptRelayAgentERO(b'\x00+\x00\x08\x00\x01\x00\x02\x00\x03\x00\x04') a.optcode == 43 and a.optlen == 8 and a.reqopts == [1,2,3,4] @@ -3857,17 +3857,17 @@ a.optcode == 43 and a.optlen == 8 and a.reqopts == [1,2,3,4] + Test DHCP6 Messages - DHCP6_Solicit = DHCP6_Solicit - Basic Instantiation -str(DHCP6_Solicit()) == '\x01\x00\x00\x00' +str(DHCP6_Solicit()) == b'\x01\x00\x00\x00' = DHCP6_Solicit - Basic Dissection -a = DHCP6_Solicit('\x01\x00\x00\x00') +a = DHCP6_Solicit(b'\x01\x00\x00\x00') a.msgtype == 1 and a.trid == 0 = DHCP6_Solicit - Basic test of DHCP6_solicit.hashret() -DHCP6_Solicit().hashret() == '\x00\x00\x00' +DHCP6_Solicit().hashret() == b'\x00\x00\x00' = DHCP6_Solicit - Test of DHCP6_solicit.hashret() with specific values -DHCP6_Solicit(trid=0xbbccdd).hashret() == '\xbb\xcc\xdd' +DHCP6_Solicit(trid=0xbbccdd).hashret() == b'\xbb\xcc\xdd' = DHCP6_Solicit - UDP ports overload a=UDP()/DHCP6_Solicit() @@ -3883,13 +3883,13 @@ isinstance(a.payload, DHCP6_Solicit) + Test DHCP6 Messages - DHCP6_Advertise = DHCP6_Advertise - Basic Instantiation -str(DHCP6_Advertise()) == '\x02\x00\x00\x00' +str(DHCP6_Advertise()) == b'\x02\x00\x00\x00' = DHCP6_Advertise - Basic test of DHCP6_solicit.hashret() -DHCP6_Advertise().hashret() == '\x00\x00\x00' +DHCP6_Advertise().hashret() == b'\x00\x00\x00' = DHCP6_Advertise - Test of DHCP6_Advertise.hashret() with specific values -DHCP6_Advertise(trid=0xbbccdd).hashret() == '\xbb\xcc\xdd' +DHCP6_Advertise(trid=0xbbccdd).hashret() == b'\xbb\xcc\xdd' = DHCP6_Advertise - Basic test of answers() with solicit message a = DHCP6_Solicit() @@ -3911,10 +3911,10 @@ a.sport == 547 and a.dport == 546 + Test DHCP6 Messages - DHCP6_Request = DHCP6_Request - Basic Instantiation -str(DHCP6_Request()) == '\x03\x00\x00\x00' +str(DHCP6_Request()) == b'\x03\x00\x00\x00' = DHCP6_Request - Basic Dissection -a=DHCP6_Request('\x03\x00\x00\x00') +a=DHCP6_Request(b'\x03\x00\x00\x00') a.msgtype == 3 and a.trid == 0 = DHCP6_Request - UDP ports overload @@ -3927,10 +3927,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Confirm = DHCP6_Confirm - Basic Instantiation -str(DHCP6_Confirm()) == '\x04\x00\x00\x00' +str(DHCP6_Confirm()) == b'\x04\x00\x00\x00' = DHCP6_Confirm - Basic Dissection -a=DHCP6_Confirm('\x04\x00\x00\x00') +a=DHCP6_Confirm(b'\x04\x00\x00\x00') a.msgtype == 4 and a.trid == 0 = DHCP6_Confirm - UDP ports overload @@ -3943,10 +3943,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Renew = DHCP6_Renew - Basic Instantiation -str(DHCP6_Renew()) == '\x05\x00\x00\x00' +str(DHCP6_Renew()) == b'\x05\x00\x00\x00' = DHCP6_Renew - Basic Dissection -a=DHCP6_Renew('\x05\x00\x00\x00') +a=DHCP6_Renew(b'\x05\x00\x00\x00') a.msgtype == 5 and a.trid == 0 = DHCP6_Renew - UDP ports overload @@ -3959,10 +3959,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Rebind = DHCP6_Rebind - Basic Instantiation -str(DHCP6_Rebind()) == '\x06\x00\x00\x00' +str(DHCP6_Rebind()) == b'\x06\x00\x00\x00' = DHCP6_Rebind - Basic Dissection -a=DHCP6_Rebind('\x06\x00\x00\x00') +a=DHCP6_Rebind(b'\x06\x00\x00\x00') a.msgtype == 6 and a.trid == 0 = DHCP6_Rebind - UDP ports overload @@ -3975,10 +3975,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Reply = DHCP6_Reply - Basic Instantiation -str(DHCP6_Reply()) == '\x07\x00\x00\x00' +str(DHCP6_Reply()) == b'\x07\x00\x00\x00' = DHCP6_Reply - Basic Dissection -a=DHCP6_Reply('\x07\x00\x00\x00') +a=DHCP6_Reply(b'\x07\x00\x00\x00') a.msgtype == 7 and a.trid == 0 = DHCP6_Reply - UDP ports overload @@ -3991,10 +3991,10 @@ a.sport == 547 and a.dport == 546 + Test DHCP6 Messages - DHCP6_Release = DHCP6_Release - Basic Instantiation -str(DHCP6_Release()) == '\x08\x00\x00\x00' +str(DHCP6_Release()) == b'\x08\x00\x00\x00' = DHCP6_Release - Basic Dissection -a=DHCP6_Release('\x08\x00\x00\x00') +a=DHCP6_Release(b'\x08\x00\x00\x00') a.msgtype == 8 and a.trid == 0 = DHCP6_Release - UDP ports overload @@ -4007,10 +4007,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Decline = DHCP6_Decline - Basic Instantiation -str(DHCP6_Decline()) == '\x09\x00\x00\x00' +str(DHCP6_Decline()) == b'\x09\x00\x00\x00' = DHCP6_Confirm - Basic Dissection -a=DHCP6_Confirm('\x09\x00\x00\x00') +a=DHCP6_Confirm(b'\x09\x00\x00\x00') a.msgtype == 9 and a.trid == 0 = DHCP6_Decline - UDP ports overload @@ -4023,10 +4023,10 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_Reconf = DHCP6_Reconf - Basic Instantiation -str(DHCP6_Reconf()) == '\x0A\x00\x00\x00' +str(DHCP6_Reconf()) == b'\x0A\x00\x00\x00' = DHCP6_Reconf - Basic Dissection -a=DHCP6_Reconf('\x0A\x00\x00\x00') +a=DHCP6_Reconf(b'\x0A\x00\x00\x00') a.msgtype == 10 and a.trid == 0 = DHCP6_Reconf - UDP ports overload @@ -4039,10 +4039,10 @@ a.sport == 547 and a.dport == 546 + Test DHCP6 Messages - DHCP6_InfoRequest = DHCP6_InfoRequest - Basic Instantiation -str(DHCP6_InfoRequest()) == '\x0B\x00\x00\x00' +str(DHCP6_InfoRequest()) == b'\x0B\x00\x00\x00' = DHCP6_InfoRequest - Basic Dissection -a=DHCP6_InfoRequest('\x0B\x00\x00\x00') +a=DHCP6_InfoRequest(b'\x0B\x00\x00\x00') a.msgtype == 11 and a.trid == 0 = DHCP6_InfoRequest - UDP ports overload @@ -4055,14 +4055,14 @@ a.sport == 546 and a.dport == 547 + Test DHCP6 Messages - DHCP6_RelayForward = DHCP6_RelayForward - Basic Instantiation -str(DHCP6_RelayForward()) == '\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6_RelayForward()) == b'\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6_RelayForward - Basic Dissection -a=DHCP6_RelayForward('\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=DHCP6_RelayForward(b'\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.msgtype == 12 and a.hopcount == 0 and a.linkaddr == "::" and a.peeraddr == "::" = DHCP6_RelayForward - Dissection with options -a = DHCP6_RelayForward('\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x04\x00\x01\x00\x00') +a = DHCP6_RelayForward(b'\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x04\x00\x01\x00\x00') a.msgtype == 12 and DHCP6OptRelayMsg in a and DHCP6OptClientId in a @@ -4071,10 +4071,10 @@ a.msgtype == 12 and DHCP6OptRelayMsg in a and DHCP6OptClientId in a + Test DHCP6 Messages - DHCP6_RelayReply = DHCP6_RelayReply - Basic Instantiation -str(DHCP6_RelayReply()) == '\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(DHCP6_RelayReply()) == b'\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = DHCP6_RelayReply - Basic Dissection -a=DHCP6_RelayReply('\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=DHCP6_RelayReply(b'\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') a.msgtype == 13 and a.hopcount == 0 and a.linkaddr == "::" and a.peeraddr == "::" @@ -4107,7 +4107,7 @@ not a < b and a > b if WINDOWS: route_add_loopback() -s = '`\x00\x00\x00\x00\x08:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x92\x00m\xbb\x00\x00\x00\x00' +s = b'`\x00\x00\x00\x00\x08:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x92\x00m\xbb\x00\x00\x00\x00' str(IPv6()/ICMPv6MPSol()) == s = ICMPv6MPSol - dissection (default values) @@ -4115,7 +4115,7 @@ p = IPv6(s) p[ICMPv6MPSol].type == 146 and p[ICMPv6MPSol].cksum == 0x6dbb and p[ICMPv6MPSol].id == 0 = ICMPv6MPSol - build -s = '`\x00\x00\x00\x00\x08:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x92\x00(\x08\x00\x08\x00\x00' +s = b'`\x00\x00\x00\x00\x08:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x92\x00(\x08\x00\x08\x00\x00' str(IPv6()/ICMPv6MPSol(cksum=0x2808, id=8)) == s = ICMPv6MPSol - dissection @@ -4123,7 +4123,7 @@ p = IPv6(s) p[ICMPv6MPSol].cksum == 0x2808 and p[ICMPv6MPSol].id == 8 = ICMPv6MPAdv - build (default values) -s = '`\x00\x00\x00\x00(:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x93\x00\xe8\xd6\x00\x00\x80\x00\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'`\x00\x00\x00\x00(:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x93\x00\xe8\xd6\x00\x00\x80\x00\x03\x04\x00\xc0\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(IPv6()/ICMPv6MPAdv()/ICMPv6NDOptPrefixInfo()) == s = ICMPv6MPAdv - dissection (default values) @@ -4131,7 +4131,7 @@ p = IPv6(s) p[ICMPv6MPAdv].type == 147 and p[ICMPv6MPAdv].cksum == 0xe8d6 and p[ICMPv6NDOptPrefixInfo].prefix == '::' = ICMPv6MPAdv - build -s = '`\x00\x00\x00\x00(:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x93\x00(\x07\x00*@\x00\x03\x04\x00@\xff\xff\xff\xff\x00\x00\x00\x0c\x00\x00\x00\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +s = b'`\x00\x00\x00\x00(:@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x93\x00(\x07\x00*@\x00\x03\x04\x00@\xff\xff\xff\xff\x00\x00\x00\x0c\x00\x00\x00\x00 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' str(IPv6()/ICMPv6MPAdv(cksum=0x2807, flags=1, id=42)/ICMPv6NDOptPrefixInfo(prefix='2001:db8::1', L=0, preferredlifetime=12)) == s = ICMPv6MPAdv - dissection @@ -4150,7 +4150,7 @@ p.type == 2 and len(p.addresses) == 1 and p.cksum == 0x2446 = IPv6ExtHdrRouting - type 2 - hashret p = IPv6()/IPv6ExtHdrRouting(addresses=["2001:db8::1", "2001:db8::2"])/ICMPv6EchoRequest() -p.hashret() == " \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x00\x00\x00\x00" +p.hashret() == b" \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x00\x00\x00\x00" ############ @@ -4158,7 +4158,7 @@ p.hashret() == " \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:\x00 + Mobility Options - Binding Refresh Advice = MIP6OptBRAdvice - build (default values) -s = '\x02\x02\x00\x00' +s = b'\x02\x02\x00\x00' str(MIP6OptBRAdvice()) == s = MIP6OptBRAdvice - dissection (default values) @@ -4166,7 +4166,7 @@ p = MIP6OptBRAdvice(s) p.otype == 2 and p.olen == 2 and p.rinter == 0 = MIP6OptBRAdvice - build -s = '\x03*\n\xf7' +s = b'\x03*\n\xf7' str(MIP6OptBRAdvice(otype=3, olen=42, rinter=2807)) == s = MIP6OptBRAdvice - dissection @@ -4179,7 +4179,7 @@ p.otype == 3 and p.olen == 42 and p.rinter == 2807 + Mobility Options - Alternate Care-of Address = MIP6OptAltCoA - build (default values) -s = '\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(MIP6OptAltCoA()) == s = MIP6OptAltCoA - dissection (default values) @@ -4187,7 +4187,7 @@ p = MIP6OptAltCoA(s) p.otype == 3 and p.olen == 16 and p.acoa == '::' = MIP6OptAltCoA - build -s = '*\x08 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' +s = b'*\x08 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' str(MIP6OptAltCoA(otype=42, olen=8, acoa='2001:db8::1')) == s = MIP6OptAltCoA - dissection @@ -4200,7 +4200,7 @@ p.otype == 42 and p.olen == 8 and p.acoa == '2001:db8::1' + Mobility Options - Nonce Indices = MIP6OptNonceIndices - build (default values) -s = '\x04\x10\x00\x00\x00\x00' +s = b'\x04\x10\x00\x00\x00\x00' str(MIP6OptNonceIndices()) == s = MIP6OptNonceIndices - dissection (default values) @@ -4208,7 +4208,7 @@ p = MIP6OptNonceIndices(s) p.otype == 4 and p.olen == 16 and p.hni == 0 and p.coni == 0 = MIP6OptNonceIndices - build -s = '\x04\x12\x00\x13\x00\x14' +s = b'\x04\x12\x00\x13\x00\x14' str(MIP6OptNonceIndices(olen=18, hni=19, coni=20)) == s = MIP6OptNonceIndices - dissection @@ -4221,7 +4221,7 @@ p.hni == 19 and p.coni == 20 + Mobility Options - Binding Authentication Data = MIP6OptBindingAuthData - build (default values) -s = '\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(MIP6OptBindingAuthData()) == s = MIP6OptBindingAuthData - dissection (default values) @@ -4229,7 +4229,7 @@ p = MIP6OptBindingAuthData(s) p.otype == 5 and p.olen == 16 and p.authenticator == 0 = MIP6OptBindingAuthData - build -s = '\x05*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\xf7' +s = b'\x05*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\xf7' str(MIP6OptBindingAuthData(olen=42, authenticator=2807)) == s = MIP6OptBindingAuthData - dissection @@ -4242,7 +4242,7 @@ p.otype == 5 and p.olen == 42 and p.authenticator == 2807 + Mobility Options - Mobile Network Prefix = MIP6OptMobNetPrefix - build (default values) -s = '\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(MIP6OptMobNetPrefix()) == s = MIP6OptMobNetPrefix - dissection (default values) @@ -4250,7 +4250,7 @@ p = MIP6OptMobNetPrefix(s) p.otype == 6 and p.olen == 18 and p.plen == 64 and p.prefix == '::' = MIP6OptMobNetPrefix - build -s = '\x06*\x02 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x06*\x02 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(MIP6OptMobNetPrefix(olen=42, reserved=2, plen=32, prefix='2001:db8::')) == s = MIP6OptMobNetPrefix - dissection @@ -4263,17 +4263,17 @@ p.olen == 42 and p.reserved == 2 and p.plen == 32 and p.prefix == '2001:db8::' + Mobility Options - Link-Layer Address (MH-LLA) = MIP6OptLLAddr - basic build -str(MIP6OptLLAddr()) == '\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00' +str(MIP6OptLLAddr()) == b'\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00' = MIP6OptLLAddr - basic dissection -p = MIP6OptLLAddr('\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00') +p = MIP6OptLLAddr(b'\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00') p.otype == 7 and p.olen == 7 and p.ocode == 2 and p.pad == 0 and p.lla == "00:00:00:00:00:00" = MIP6OptLLAddr - build with specific values -str(MIP6OptLLAddr(olen=42, ocode=4, pad=0xff, lla='EE:EE:EE:EE:EE:EE')) == '\x07*\x04\xff\xee\xee\xee\xee\xee\xee' +str(MIP6OptLLAddr(olen=42, ocode=4, pad=0xff, lla='EE:EE:EE:EE:EE:EE')) == b'\x07*\x04\xff\xee\xee\xee\xee\xee\xee' = MIP6OptLLAddr - dissection with specific values -p = MIP6OptLLAddr('\x07*\x04\xff\xee\xee\xee\xee\xee\xee') +p = MIP6OptLLAddr(b'\x07*\x04\xff\xee\xee\xee\xee\xee\xee') str(MIP6OptLLAddr(olen=42, ocode=4, pad=0xff, lla='EE:EE:EE:EE:EE:EE')) p.otype == 7 and p.olen == 42 and p.ocode == 4 and p.pad == 0xff and p.lla == "ee:ee:ee:ee:ee:ee" @@ -4284,17 +4284,17 @@ p.otype == 7 and p.olen == 42 and p.ocode == 4 and p.pad == 0xff and p.lla == "e + Mobility Options - Mobile Node Identifier = MIP6OptMNID - basic build -str(MIP6OptMNID()) == '\x08\x01\x01' +str(MIP6OptMNID()) == b'\x08\x01\x01' = MIP6OptMNID - basic dissection -p = MIP6OptMNID('\x08\x01\x01') +p = MIP6OptMNID(b'\x08\x01\x01') p.otype == 8 and p.olen == 1 and p.subtype == 1 and p.id == "" = MIP6OptMNID - build with specific values -str(MIP6OptMNID(subtype=42, id="someid")) == '\x08\x07*someid' +str(MIP6OptMNID(subtype=42, id="someid")) == b'\x08\x07*someid' = MIP6OptMNID - dissection with specific values -p = MIP6OptMNID('\x08\x07*someid') +p = MIP6OptMNID(b'\x08\x07*someid') p.otype == 8 and p.olen == 7 and p.subtype == 42 and p.id == "someid" @@ -4304,17 +4304,17 @@ p.otype == 8 and p.olen == 7 and p.subtype == 42 and p.id == "someid" + Mobility Options - Message Authentication = MIP6OptMsgAuth - basic build -str(MIP6OptMsgAuth()) == '\x09\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' +str(MIP6OptMsgAuth()) == b'\x09\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' = MIP6OptMsgAuth - basic dissection -p = MIP6OptMsgAuth('\x09\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA') +p = MIP6OptMsgAuth(b'\x09\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA') p.otype == 9 and p.olen == 17 and p.subtype == 1 and p.mspi == 0 and p.authdata == "A"*12 = MIP6OptMsgAuth - build with specific values -str(MIP6OptMsgAuth(authdata="B"*16, mspi=0xeeeeeeee, subtype=0xff)) == '\t\x15\xff\xee\xee\xee\xeeBBBBBBBBBBBBBBBB' +str(MIP6OptMsgAuth(authdata="B"*16, mspi=0xeeeeeeee, subtype=0xff)) == b'\t\x15\xff\xee\xee\xee\xeeBBBBBBBBBBBBBBBB' = MIP6OptMsgAuth - dissection with specific values -p = MIP6OptMsgAuth('\t\x15\xff\xee\xee\xee\xeeBBBBBBBBBBBBBBBB') +p = MIP6OptMsgAuth(b'\t\x15\xff\xee\xee\xee\xeeBBBBBBBBBBBBBBBB') p.otype == 9 and p.olen == 21 and p.subtype == 255 and p.mspi == 0xeeeeeeee and p.authdata == "B"*16 @@ -4323,15 +4323,15 @@ p.otype == 9 and p.olen == 21 and p.subtype == 255 and p.mspi == 0xeeeeeeee and + Mobility Options - Replay Protection = MIP6OptReplayProtection - basic build -str(MIP6OptReplayProtection()) == '\n\x08\x00\x00\x00\x00\x00\x00\x00\x00' +str(MIP6OptReplayProtection()) == b'\n\x08\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6OptReplayProtection - basic dissection -p = MIP6OptReplayProtection('\n\x08\x00\x00\x00\x00\x00\x00\x00\x00') +p = MIP6OptReplayProtection(b'\n\x08\x00\x00\x00\x00\x00\x00\x00\x00') p.otype == 10 and p.olen == 8 and p.timestamp == 0 = MIP6OptReplayProtection - build with specific values s = str(MIP6OptReplayProtection(olen=42, timestamp=(72*31536000)<<32)) -s == '\n*\x87V|\x00\x00\x00\x00\x00' +s == b'\n*\x87V|\x00\x00\x00\x00\x00' = MIP6OptReplayProtection - dissection with specific values p = MIP6OptReplayProtection(s) @@ -4373,238 +4373,238 @@ p.fields_desc[-1].i2repr("", p.timestamp) == 'Mon, 13 Dec 1971 23:50:39 +0000 (9 ############ + Mobility Options - Automatic Padding - MIP6OptBRAdvice = Mobility Options - Automatic Padding - MIP6OptBRAdvice -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptBRAdvice()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x02\x02\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x02\x02\x00\x00\x01\x04\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x02\x02\x00\x00\x01\x04\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x00\x02\x02\x00\x00\x01\x02\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x02\x02\x00\x00\x01\x02\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x02\x02\x00\x00\x01\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x02\x02\x00\x00\x01\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x02\x02\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptBRAdvice()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x02\x02\x00\x00' +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptBRAdvice()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x02\x02\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x02\x02\x00\x00\x01\x04\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x02\x02\x00\x00\x01\x04\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x00\x02\x02\x00\x00\x01\x02\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x02\x02\x00\x00\x01\x02\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x02\x02\x00\x00\x01\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x02\x02\x00\x00\x01\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x02\x02\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptBRAdvice()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x02\x02\x00\x00' a and b and c and d and e and g and h and i and j - -############ -############ -+ Mobility Options - Automatic Padding - MIP6OptAltCoA -= Mobility Options - Automatic Padding - MIP6OptAltCoA -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptAltCoA()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptAltCoA()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptAltCoA()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x05\x00\x00\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x04\x00\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x01\x03\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptAltCoA()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + +############ +############ ++ Mobility Options - Automatic Padding - MIP6OptAltCoA += Mobility Options - Automatic Padding - MIP6OptAltCoA +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptAltCoA()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptAltCoA()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptAltCoA()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x05\x00\x00\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x04\x00\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x01\x03\x00\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptAltCoA()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptNonceIndices -= Mobility Options - Automatic Padding - MIP6OptNonceIndices -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x04\x10\x00\x00\x00\x00\x01\x02\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x04\x10\x00\x00\x00\x00\x01\x02\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x00\x04\x10\x00\x00\x00\x00\x01\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x04\x10\x00\x00\x00\x00\x01\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptNonceIndices()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptNonceIndices()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptNonceIndices()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' ++ Mobility Options - Automatic Padding - MIP6OptNonceIndices += Mobility Options - Automatic Padding - MIP6OptNonceIndices +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x00\x04\x10\x00\x00\x00\x00\x01\x02\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x04\x10\x00\x00\x00\x00\x01\x02\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x00\x04\x10\x00\x00\x00\x00\x01\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x04\x10\x00\x00\x00\x00\x01\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptNonceIndices()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptNonceIndices()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptNonceIndices()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x04\x10\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptBindingAuthData -= Mobility Options - Automatic Padding - MIP6OptBindingAuthData -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x03\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x02\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x01\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptBindingAuthData()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptBindingAuthData()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptBindingAuthData()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ++ Mobility Options - Automatic Padding - MIP6OptBindingAuthData += Mobility Options - Automatic Padding - MIP6OptBindingAuthData +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x03\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x02\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x01\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptBindingAuthData()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptBindingAuthData()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptBindingAuthData()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00\x05\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptMobNetPrefix -= Mobility Options - Automatic Padding - MIP6OptMobNetPrefix -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMobNetPrefix()])) == ';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x05\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x04\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x03\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x02\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x01\x01\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptMobNetPrefix()])) == ';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ++ Mobility Options - Automatic Padding - MIP6OptMobNetPrefix += Mobility Options - Automatic Padding - MIP6OptMobNetPrefix +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMobNetPrefix()])) == b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x05\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x04\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x03\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x02\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x01\x01\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptMobNetPrefix()])) == b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptLLAddr -= Mobility Options - Automatic Padding - MIP6OptLLAddr -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptLLAddr()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptLLAddr()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptLLAddr()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptLLAddr()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptLLAddr += Mobility Options - Automatic Padding - MIP6OptLLAddr +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptLLAddr()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptLLAddr()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptLLAddr()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptLLAddr()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptMNID -= Mobility Options - Automatic Padding - MIP6OptMNID -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMNID()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x08\x01\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMNID()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x08\x01\x01' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x08\x01\x01\x01\x05\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x08\x01\x01\x01\x04\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x08\x01\x01\x01\x03\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x08\x01\x01\x01\x02\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x08\x01\x01\x01\x01\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x08\x01\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptMNID()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x08\x01\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptMNID += Mobility Options - Automatic Padding - MIP6OptMNID +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMNID()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x08\x01\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMNID()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x08\x01\x01' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x08\x01\x01\x01\x05\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x08\x01\x01\x01\x04\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x08\x01\x01\x01\x03\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x08\x01\x01\x01\x02\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x08\x01\x01\x01\x01\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x08\x01\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptMNID()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x08\x01\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptMsgAuth -= Mobility Options - Automatic Padding - MIP6OptMsgAuth -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMsgAuth()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMsgAuth()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptMsgAuth()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' ++ Mobility Options - Automatic Padding - MIP6OptMsgAuth += Mobility Options - Automatic Padding - MIP6OptMsgAuth +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptMsgAuth()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptMsgAuth()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA\x01\x02\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x01\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptMsgAuth()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x00\t\x11\x01\x00\x00\x00\x00AAAAAAAAAAAA' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptReplayProtection -= Mobility Options - Automatic Padding - MIP6OptReplayProtection -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x03\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x02\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x01\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptReplayProtection()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptReplayProtection()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptReplayProtection()])) ==';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' ++ Mobility Options - Automatic Padding - MIP6OptReplayProtection += Mobility Options - Automatic Padding - MIP6OptReplayProtection +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x01\x03\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x01\x02\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x01\x01\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x01\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptReplayProtection()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptReplayProtection()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptReplayProtection()])) ==b';\x04\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00\n\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptCGAParamsReq -= Mobility Options - Automatic Padding - MIP6OptCGAParamsReq -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCGAParamsReq()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0b\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCGAParamsReq()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0b\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptCGAParamsReq()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0b\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0b\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0b\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0b\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0b\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0b\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptCGAParamsReq()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0b\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptCGAParamsReq += Mobility Options - Automatic Padding - MIP6OptCGAParamsReq +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCGAParamsReq()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0b\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCGAParamsReq()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0b\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptCGAParamsReq()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0b\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0b\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0b\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0b\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0b\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0b\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptCGAParamsReq()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0b\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptCGAParams -= Mobility Options - Automatic Padding - MIP6OptCGAParams -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCGAParams()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0c\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCGAParams()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0c\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptCGAParams()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0c\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0c\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0c\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0c\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0c\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0c\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptCGAParams()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0c\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptCGAParams += Mobility Options - Automatic Padding - MIP6OptCGAParams +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCGAParams()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0c\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCGAParams()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0c\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptCGAParams()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0c\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0c\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0c\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0c\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0c\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0c\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptCGAParams()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0c\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptSignature -= Mobility Options - Automatic Padding - MIP6OptSignature -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptSignature()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\r\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptSignature()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\r\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptSignature()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\r\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\r\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\r\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\r\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\r\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\r\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptSignature()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\r\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptSignature += Mobility Options - Automatic Padding - MIP6OptSignature +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptSignature()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\r\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptSignature()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\r\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptSignature()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\r\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\r\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\r\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\r\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\r\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\r\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptSignature()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\r\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptHomeKeygenToken -= Mobility Options - Automatic Padding - MIP6OptHomeKeygenToken -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptHomeKeygenToken()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0e\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptHomeKeygenToken()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0e\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptHomeKeygenToken()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0e\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0e\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0e\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0e\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0e\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0e\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptHomeKeygenToken()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0e\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptHomeKeygenToken += Mobility Options - Automatic Padding - MIP6OptHomeKeygenToken +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptHomeKeygenToken()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0e\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptHomeKeygenToken()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0e\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptHomeKeygenToken()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0e\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0e\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0e\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0e\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0e\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0e\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptHomeKeygenToken()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0e\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptCareOfTestInit -= Mobility Options - Automatic Padding - MIP6OptCareOfTestInit -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCareOfTestInit()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0f\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCareOfTestInit()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0f\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptCareOfTestInit()])) ==';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0f\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0f\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0f\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0f\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0f\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0f\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptCareOfTestInit()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptCareOfTestInit += Mobility Options - Automatic Padding - MIP6OptCareOfTestInit +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCareOfTestInit()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x0f\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCareOfTestInit()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x0f\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptCareOfTestInit()])) ==b';\x01\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x0f\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x0f\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x0f\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x0f\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x0f\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x0f\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptCareOfTestInit()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00' a and b and c and d and e and g and h and i and j - + ############ ############ -+ Mobility Options - Automatic Padding - MIP6OptCareOfTest -= Mobility Options - Automatic Padding - MIP6OptCareOfTest -a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCareOfTest()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00' -b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCareOfTest()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00' -c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*0),MIP6OptCareOfTest()])) ==';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00' -d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*1),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00' -e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*2),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' -g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*3),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00' -h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*4),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' -i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*5),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00' -j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata='\x00'*6),MIP6OptCareOfTest()])) ==';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00' ++ Mobility Options - Automatic Padding - MIP6OptCareOfTest += Mobility Options - Automatic Padding - MIP6OptCareOfTest +a = str(MIP6MH_BU(seq=0x4242, options=[MIP6OptCareOfTest()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00' +b = str(MIP6MH_BU(seq=0x4242, options=[Pad1(),MIP6OptCareOfTest()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00' +c = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*0),MIP6OptCareOfTest()])) ==b';\x02\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00' +d = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*1),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x01\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00' +e = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*2),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x02\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x04\x00\x00\x00\x00' +g = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*3),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x03\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00\x00\x00' +h = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*4),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x04\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00' +i = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*5),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x05\x00\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00' +j = str(MIP6MH_BU(seq=0x4242, options=[PadN(optdata=b'\x00'*6),MIP6OptCareOfTest()])) ==b';\x03\x05\x00\x00\x00BB\xd0\x00\x00\x03\x01\x06\x00\x00\x00\x00\x00\x00\x10\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00' a and b and c and d and e and g and h and i and j @@ -4612,18 +4612,18 @@ a and b and c and d and e and g and h and i and j ############ + Binding Refresh Request Message = MIP6MH_BRR - Build (default values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_BRR()) == '`\x00\x00\x00\x00\x08\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x00\x00\x00h\xfb\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_BRR()) == b'`\x00\x00\x00\x00\x08\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x00\x00\x00h\xfb\x00\x00' = MIP6MH_BRR - Build with specific values -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_BRR(nh=0xff, res=0xee, res2=0xaaaa, options=[MIP6OptLLAddr(), MIP6OptAltCoA()])) == '`\x00\x00\x00\x00(\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xff\x04\x00\xee\xec$\xaa\xaa\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_BRR(nh=0xff, res=0xee, res2=0xaaaa, options=[MIP6OptLLAddr(), MIP6OptAltCoA()])) == b'`\x00\x00\x00\x00(\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xff\x04\x00\xee\xec$\xaa\xaa\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6MH_BRR - Basic dissection -a=IPv6('`\x00\x00\x00\x00\x08\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x00\x00\x00h\xfb\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x08\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x00\x00\x00h\xfb\x00\x00') b=a.payload a.nh == 135 and isinstance(b, MIP6MH_BRR) and b.nh == 59 and b.len == 0 and b.mhtype == 0 and b.res == 0 and b.cksum == 0x68fb and b.res2 == 0 and b.options == [] = MIP6MH_BRR - Dissection with specific values -a=IPv6('`\x00\x00\x00\x00(\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xff\x04\x00\xee\xec$\xaa\xaa\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00(\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xff\x04\x00\xee\xec$\xaa\xaa\x07\x07\x02\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') b=a.payload a.nh == 135 and isinstance(b, MIP6MH_BRR) and b.nh == 0xff and b.len == 4 and b.mhtype == 0 and b.res == 238 and b.cksum == 0xec24 and b.res2 == 43690 and len(b.options) == 3 and isinstance(b.options[0], MIP6OptLLAddr) and isinstance(b.options[1], PadN) and isinstance(b.options[2], MIP6OptAltCoA) @@ -4646,21 +4646,21 @@ len(b[IPv6ExtHdrDestOpt].options) == 2 + Home Test Init Message = MIP6MH_HoTI - Build (default values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoTI()) == '`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01\x00g\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoTI()) == b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01\x00g\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6MH_HoTI - Dissection (default values) -a=IPv6('`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01\x00g\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01\x00g\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_HoTI) and b.nh==59 and b.mhtype == 1 and b.len== 1 and b.res == 0 and b.cksum == 0x67f2 and b.cookie == '\x00'*8 +a.nh == 135 and isinstance(b, MIP6MH_HoTI) and b.nh==59 and b.mhtype == 1 and b.len== 1 and b.res == 0 and b.cksum == 0x67f2 and b.cookie == b'\x00'*8 = MIP6MH_HoTI - Build (specific values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoTI(res=0x77, cksum=0x8899, cookie="\xAA"*8)) == '`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoTI(res=0x77, cksum=0x8899, cookie=b"\xAA"*8)) == b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' = MIP6MH_HoTI - Dissection (specific values) -a=IPv6('`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa') +a=IPv6(b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x01w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa') b=a.payload -a.nh == 135 and isinstance(b, MIP6MH_HoTI) and b.nh==59 and b.mhtype == 1 and b.len == 1 and b.res == 0x77 and b.cksum == 0x8899 and b.cookie == '\xAA'*8 +a.nh == 135 and isinstance(b, MIP6MH_HoTI) and b.nh==59 and b.mhtype == 1 and b.len == 1 and b.res == 0x77 and b.cksum == 0x8899 and b.cookie == b'\xAA'*8 ############ @@ -4668,20 +4668,20 @@ a.nh == 135 and isinstance(b, MIP6MH_HoTI) and b.nh==59 and b.mhtype == 1 and b. + Care-of Test Init Message = MIP6MH_CoTI - Build (default values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoTI()) == '`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02\x00f\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoTI()) == b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02\x00f\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6MH_CoTI - Dissection (default values) -a=IPv6('`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02\x00f\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02\x00f\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_CoTI) and b.nh==59 and b.mhtype == 2 and b.len== 1 and b.res == 0 and b.cksum == 0x66f2 and b.cookie == '\x00'*8 +a.nh == 135 and isinstance(b, MIP6MH_CoTI) and b.nh==59 and b.mhtype == 2 and b.len== 1 and b.res == 0 and b.cksum == 0x66f2 and b.cookie == b'\x00'*8 = MIP6MH_CoTI - Build (specific values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoTI(res=0x77, cksum=0x8899, cookie="\xAA"*8)) == '`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoTI(res=0x77, cksum=0x8899, cookie=b"\xAA"*8)) == b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa' = MIP6MH_CoTI - Dissection (specific values) -a=IPv6('`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa') +a=IPv6(b'`\x00\x00\x00\x00\x10\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x01\x02w\x88\x99\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa') b=a.payload -a.nh == 135 and isinstance(b, MIP6MH_CoTI) and b.nh==59 and b.mhtype == 2 and b.len == 1 and b.res == 0x77 and b.cksum == 0x8899 and b.cookie == '\xAA'*8 +a.nh == 135 and isinstance(b, MIP6MH_CoTI) and b.nh==59 and b.mhtype == 2 and b.len == 1 and b.res == 0x77 and b.cksum == 0x8899 and b.cookie == b'\xAA'*8 ############ @@ -4689,27 +4689,27 @@ a.nh == 135 and isinstance(b, MIP6MH_CoTI) and b.nh==59 and b.mhtype == 2 and b. + Home Test Message = MIP6MH_HoT - Build (default values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoT()) == '`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03\x00e\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoT()) == b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03\x00e\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6MH_HoT - Dissection (default values) -a=IPv6('`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03\x00e\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03\x00e\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 3 and b.len== 2 and b.res == 0 and b.cksum == 0x65e9 and b.index == 0 and b.cookie == '\x00'*8 and b.token == '\x00'*8 +a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 3 and b.len== 2 and b.res == 0 and b.cksum == 0x65e9 and b.index == 0 and b.cookie == b'\x00'*8 and b.token == b'\x00'*8 = MIP6MH_HoT - Build (specific values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoT(res=0x77, cksum=0x8899, cookie="\xAA"*8, index=0xAABB, token='\xCC'*8)) == '`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_HoT(res=0x77, cksum=0x8899, cookie=b"\xAA"*8, index=0xAABB, token=b'\xCC'*8)) == b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc' = MIP6MH_HoT - Dissection (specific values) -a=IPv6('`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc') +a=IPv6(b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x03w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 3 and b.len== 2 and b.res == 0x77 and b.cksum == 0x8899 and b.index == 0xAABB and b.cookie == '\xAA'*8 and b.token == '\xCC'*8 +a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 3 and b.len== 2 and b.res == 0x77 and b.cksum == 0x8899 and b.index == 0xAABB and b.cookie == b'\xAA'*8 and b.token == b'\xCC'*8 = MIP6MH_HoT answers a1, a2 = "2001:db8::1", "2001:db8::2" cookie = RandString(8)._fix() p1 = IPv6(src=a1, dst=a2)/MIP6MH_HoTI(cookie=cookie) p2 = IPv6(src=a2, dst=a1)/MIP6MH_HoT(cookie=cookie) -p2_ko = IPv6(src=a2, dst=a1)/MIP6MH_HoT(cookie="".join(chr((ord('\xff') + 1) % 256))) +p2_ko = IPv6(src=a2, dst=a1)/MIP6MH_HoT(cookie="".join(chr((ord(b'\xff') + 1) % 256))) assert p1.hashret() == p2.hashret() and p2.answers(p1) and not p1.answers(p2) assert p1.hashret() != p2_ko.hashret() and not p2_ko.answers(p1) and not p1.answers(p2_ko) @@ -4719,20 +4719,20 @@ assert p1.hashret() != p2_ko.hashret() and not p2_ko.answers(p1) and not p1.answ + Care-of Test Message = MIP6MH_CoT - Build (default values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoT()) == '`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04\x00d\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoT()) == b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04\x00d\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = MIP6MH_CoT - Dissection (default values) -a=IPv6('`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04\x00d\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +a=IPv6(b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04\x00d\xe9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 4 and b.len== 2 and b.res == 0 and b.cksum == 0x64e9 and b.index == 0 and b.cookie == '\x00'*8 and b.token == '\x00'*8 +a.nh == 135 and isinstance(b, MIP6MH_HoT) and b.nh==59 and b.mhtype == 4 and b.len== 2 and b.res == 0 and b.cksum == 0x64e9 and b.index == 0 and b.cookie == b'\x00'*8 and b.token == b'\x00'*8 = MIP6MH_CoT - Build (specific values) -str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoT(res=0x77, cksum=0x8899, cookie="\xAA"*8, index=0xAABB, token='\xCC'*8)) == '`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc' +str(IPv6(src="2001:db8::1", dst="2001:db8::2")/MIP6MH_CoT(res=0x77, cksum=0x8899, cookie=b"\xAA"*8, index=0xAABB, token=b'\xCC'*8)) == b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc' = MIP6MH_CoT - Dissection (specific values) -a=IPv6('`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc') +a=IPv6(b'`\x00\x00\x00\x00\x18\x87@ \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02;\x02\x04w\x88\x99\xaa\xbb\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc') b = a.payload -a.nh == 135 and isinstance(b, MIP6MH_CoT) and b.nh==59 and b.mhtype == 4 and b.len== 2 and b.res == 0x77 and b.cksum == 0x8899 and b.index == 0xAABB and b.cookie == '\xAA'*8 and b.token == '\xCC'*8 +a.nh == 135 and isinstance(b, MIP6MH_CoT) and b.nh==59 and b.mhtype == 4 and b.len== 2 and b.res == 0x77 and b.cksum == 0x8899 and b.index == 0xAABB and b.cookie == b'\xAA'*8 and b.token == b'\xCC'*8 ############ @@ -4740,7 +4740,7 @@ a.nh == 135 and isinstance(b, MIP6MH_CoT) and b.nh==59 and b.mhtype == 4 and b.l + Binding Update Message = MIP6MH_BU - build (default values) -s= '`\x00\x00\x00\x00(<@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x02\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x01\x05\x00\xee`\x00\x00\xd0\x00\x00\x03\x01\x02\x00\x00' +s= b'`\x00\x00\x00\x00(<@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x02\x01\x02\x00\x00\xc9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x01\x05\x00\xee`\x00\x00\xd0\x00\x00\x03\x01\x02\x00\x00' str(IPv6()/IPv6ExtHdrDestOpt(options=[HAO()])/MIP6MH_BU()) == s = MIP6MH_BU - dissection (default values) @@ -4748,7 +4748,7 @@ p = IPv6(s) p[MIP6MH_BU].len == 1 = MIP6MH_BU - build -s = '`\x00\x00\x00\x00P<@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x02\x01\x02\x00\x00\xc9\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe;\x06\x05\x00\xea\xf2\x00\x00\xd0\x00\x00*\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'`\x00\x00\x00\x00P<@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x87\x02\x01\x02\x00\x00\xc9\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xfe;\x06\x05\x00\xea\xf2\x00\x00\xd0\x00\x00*\x01\x00\x03\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x00\x00\x06\x12\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' str(IPv6()/IPv6ExtHdrDestOpt(options=[HAO(hoa='2001:db8::cafe')])/MIP6MH_BU(mhtime=42, options=[MIP6OptAltCoA(),MIP6OptMobNetPrefix()])) == s = MIP6MH_BU - dissection @@ -4761,7 +4761,7 @@ p[MIP6MH_BU].cksum == 0xeaf2 and p[MIP6MH_BU].len == 6 and len(p[MIP6MH_BU].opti + Binding ACK Message = MIP6MH_BA - build -s = '`\x00\x00\x00\x00\x10\x87@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01;\x01\x06\x00\xbc\xb9\x00\x80\x00\x00\x00*\x01\x02\x00\x00' +s = b'`\x00\x00\x00\x00\x10\x87@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01;\x01\x06\x00\xbc\xb9\x00\x80\x00\x00\x00*\x01\x02\x00\x00' str(IPv6()/MIP6MH_BA(mhtime=42)) == s = MIP6MH_BA - dissection @@ -4774,7 +4774,7 @@ p[MIP6MH_BA].cksum == 0xbcb9 and p[MIP6MH_BA].len == 1 and len(p[MIP6MH_BA].opti + Binding ERR Message = MIP6MH_BE - build -s = '`\x00\x00\x00\x00\x18\x87@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01;\x02\x07\x00\xbbY\x02\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' +s = b'`\x00\x00\x00\x00\x18\x87@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01;\x02\x07\x00\xbbY\x02\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02' str(IPv6()/MIP6MH_BE(status=2, ha='1::2')) == s = MIP6MH_BE - dissection @@ -4788,18 +4788,18 @@ p[MIP6MH_BE].cksum=0xba10 and p[MIP6MH_BE].len == 1 and len(p[MIP6MH_BE].options = NetflowHeaderV5 - basic building -str(NetflowHeader()/NetflowHeaderV5()) == '\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(NetflowHeader()/NetflowHeaderV5()) == b'\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -str(NetflowHeaderV5(engineID=42)) == '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x00\x00' +str(NetflowHeaderV5(engineID=42)) == b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x00\x00' -str(NetflowRecordV5(dst="192.168.0.1")) == '\x7f\x00\x00\x01\xc0\xa8\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(NetflowRecordV5(dst="192.168.0.1")) == b'\x7f\x00\x00\x01\xc0\xa8\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00' -str(NetflowHeader()/NetflowHeaderV5(count=1)/NetflowRecordV5(dst="192.168.0.1")) == '\x00\x05\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\xc0\xa8\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00' +str(NetflowHeader()/NetflowHeaderV5(count=1)/NetflowRecordV5(dst="192.168.0.1")) == b'\x00\x05\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\xc0\xa8\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00' = NetflowHeaderV5 - basic dissection -nf5 = NetflowHeader('\x00\x05\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00') +nf5 = NetflowHeader(b'\x00\x05\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00') nf5.version == 5 and nf5[NetflowHeaderV5].count == 2 and isinstance(nf5[NetflowRecordV5].payload, NetflowRecordV5) @@ -4809,9 +4809,9 @@ nf5.version == 5 and nf5[NetflowHeaderV5].count == 2 and isinstance(nf5[NetflowR = Variable creations import cStringIO -pcapfile = cStringIO.StringIO('\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') -pcapngfile = cStringIO.StringIO('\n\r\r\n\\\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00,\x00File created by merging: \nFile1: test.pcap \n\x04\x00\x08\x00mergecap\x00\x00\x00\x00\\\x00\x00\x00\x01\x00\x00\x00\\\x00\x00\x00e\x00\x00\x00\xff\xff\x00\x00\x02\x006\x00Unknown/not available in original file format(libpcap)\x00\x00\t\x00\x01\x00\x06\x00\x00\x00\x00\x00\x00\x00\\\x00\x00\x00\x06\x00\x00\x00H\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00/\xfc[\xcd(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00H\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\x1f\xff[\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r<\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\xb9\x02\\\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00<\x00\x00\x00') -pcapnanofile = cStringIO.StringIO("M<\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacV\xc9\xc1\xb5'(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV-;\xc1'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\x9aL\xcf'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00") +pcapfile = cStringIO.StringIO(b'\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') +pcapngfile = cStringIO.StringIO(b'\n\r\r\n\\\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00,\x00File created by merging: \nFile1: test.pcap \n\x04\x00\x08\x00mergecap\x00\x00\x00\x00\\\x00\x00\x00\x01\x00\x00\x00\\\x00\x00\x00e\x00\x00\x00\xff\xff\x00\x00\x02\x006\x00Unknown/not available in original file format(libpcap)\x00\x00\t\x00\x01\x00\x06\x00\x00\x00\x00\x00\x00\x00\\\x00\x00\x00\x06\x00\x00\x00H\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00/\xfc[\xcd(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00H\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\x1f\xff[\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r<\x00\x00\x00\x06\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x8d*\x05\x00\xb9\x02\\\xcd\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00<\x00\x00\x00') +pcapnanofile = cStringIO.StringIO(b"M<\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacV\xc9\xc1\xb5'(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV-;\xc1'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\x9aL\xcf'\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00") = Read a pcap file pktpcap = rdpcap(pcapfile) @@ -4872,7 +4872,7 @@ os.unlink(filename) = Check PcapNg with nanosecond precision using obsolete packet block * first packet from capture file icmp2.ntar -- https://wiki.wireshark.org/Development/PcapNg?action=AttachFile&do=view&target=icmp2.ntar -pcapngfile = cStringIO.StringIO('\n\r\r\n\x1c\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xa8\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x01\x00\x00\x00(\x00\x00\x00\x01\x00\x00\x00\xff\xff\x00\x00\r\x00\x01\x00\x04\x04K\x00\t\x00\x01\x00\tK=N\x00\x00\x00\x00(\x00\x00\x00\x02\x00\x00\x00n\x00\x00\x00\x00\x00\x00\x00e\x14\x00\x00)4\'ON\x00\x00\x00N\x00\x00\x00\x00\x12\xf0\x11h\xd6\x00\x13r\t{\xea\x08\x00E\x00\x00<\x90\xa1\x00\x00\x80\x01\x8e\xad\xc0\xa8M\x07\xc0\xa8M\x1a\x08\x00r[\x03\x00\xd8\x00abcdefghijklmnopqrstuvwabcdefghi\xeay$\xf6\x00\x00n\x00\x00\x00') +pcapngfile = cStringIO.StringIO(b'\n\r\r\n\x1c\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xa8\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x01\x00\x00\x00(\x00\x00\x00\x01\x00\x00\x00\xff\xff\x00\x00\r\x00\x01\x00\x04\x04K\x00\t\x00\x01\x00\tK=N\x00\x00\x00\x00(\x00\x00\x00\x02\x00\x00\x00n\x00\x00\x00\x00\x00\x00\x00e\x14\x00\x00)4\'ON\x00\x00\x00N\x00\x00\x00\x00\x12\xf0\x11h\xd6\x00\x13r\t{\xea\x08\x00E\x00\x00<\x90\xa1\x00\x00\x80\x01\x8e\xad\xc0\xa8M\x07\xc0\xa8M\x1a\x08\x00r[\x03\x00\xd8\x00abcdefghijklmnopqrstuvwabcdefghi\xeay$\xf6\x00\x00n\x00\x00\x00') pktpcapng = rdpcap(pcapngfile) assert len(pktpcapng) == 1 pkt = pktpcapng[0] @@ -4886,13 +4886,13 @@ assert isinstance(pkt, ICMP) pkt = pkt.payload assert isinstance(pkt, Raw) and pkt.load == 'abcdefghijklmnopqrstuvwabcdefghi' pkt = pkt.payload -assert isinstance(pkt, Padding) and pkt.load == '\xeay$\xf6' +assert isinstance(pkt, Padding) and pkt.load == b'\xeay$\xf6' pkt = pkt.payload assert isinstance(pkt, NoPayload) = Check PcapNg using Simple Packet Block * previous file with the (obsolete) packet block replaced by a Simple Packet Block -pcapngfile = cStringIO.StringIO('\n\r\r\n\x1c\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xa8\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x01\x00\x00\x00(\x00\x00\x00\x01\x00\x00\x00\xff\xff\x00\x00\r\x00\x01\x00\x04\x04K\x00\t\x00\x01\x00\tK=N\x00\x00\x00\x00(\x00\x00\x00\x03\x00\x00\x00`\x00\x00\x00N\x00\x00\x00\x00\x12\xf0\x11h\xd6\x00\x13r\t{\xea\x08\x00E\x00\x00<\x90\xa1\x00\x00\x80\x01\x8e\xad\xc0\xa8M\x07\xc0\xa8M\x1a\x08\x00r[\x03\x00\xd8\x00abcdefghijklmnopqrstuvwabcdefghi\xeay$\xf6\x00\x00`\x00\x00\x00') +pcapngfile = cStringIO.StringIO(b'\n\r\r\n\x1c\x00\x00\x00M<+\x1a\x01\x00\x00\x00\xa8\x03\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x01\x00\x00\x00(\x00\x00\x00\x01\x00\x00\x00\xff\xff\x00\x00\r\x00\x01\x00\x04\x04K\x00\t\x00\x01\x00\tK=N\x00\x00\x00\x00(\x00\x00\x00\x03\x00\x00\x00`\x00\x00\x00N\x00\x00\x00\x00\x12\xf0\x11h\xd6\x00\x13r\t{\xea\x08\x00E\x00\x00<\x90\xa1\x00\x00\x80\x01\x8e\xad\xc0\xa8M\x07\xc0\xa8M\x1a\x08\x00r[\x03\x00\xd8\x00abcdefghijklmnopqrstuvwabcdefghi\xeay$\xf6\x00\x00`\x00\x00\x00') pktpcapng = rdpcap(pcapngfile) assert len(pktpcapng) == 1 pkt = pktpcapng[0] @@ -4904,14 +4904,14 @@ assert isinstance(pkt, ICMP) pkt = pkt.payload assert isinstance(pkt, Raw) and pkt.load == 'abcdefghijklmnopqrstuvwabcdefghi' pkt = pkt.payload -assert isinstance(pkt, Padding) and pkt.load == '\xeay$\xf6' +assert isinstance(pkt, Padding) and pkt.load == b'\xeay$\xf6' pkt = pkt.payload assert isinstance(pkt, NoPayload) = Check tcpdump() ~ tcpdump * No very specific tests because we do not want to depend on tcpdump output -pcapfile = cStringIO.StringIO('\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') +pcapfile = cStringIO.StringIO(b'\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') data = tcpdump(pcapfile, dump=True, args=['-n']).split('\n') print data assert 'IP 127.0.0.1.20 > 127.0.0.1.80:' in data[0] @@ -4920,7 +4920,7 @@ assert 'IP 127.0.0.1 > 127.0.0.1:' in data[2] = Check tcpdump() command with tshark ~ tshark -pcapfile = cStringIO.StringIO('\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') +pcapfile = cStringIO.StringIO(b'\xd4\xc3\xb2\xa1\x02\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00e\x00\x00\x00\xcf\xc5\xacVo*\n\x00(\x00\x00\x00(\x00\x00\x00E\x00\x00(\x00\x01\x00\x00@\x06|\xcd\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x14\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00\x91|\x00\x00\xcf\xc5\xacV_-\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x11|\xce\x7f\x00\x00\x01\x7f\x00\x00\x01\x005\x005\x00\x08\x01r\xcf\xc5\xacV\xf90\n\x00\x1c\x00\x00\x00\x1c\x00\x00\x00E\x00\x00\x1c\x00\x01\x00\x00@\x01|\xde\x7f\x00\x00\x01\x7f\x00\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00') values = [tuple(int(val) for val in line[:-1].split('\t')) for line in tcpdump(pcapfile, prog=conf.prog.tshark, getfd=True, args=['-T', 'fields', '-e', 'ip.ttl', '-e', 'ip.proto'])] assert values == [(64, 6), (64, 17), (64, 1)] @@ -4930,7 +4930,7 @@ assert values == [(64, 6), (64, 17), (64, 1)] + LLTD protocol = Simple packet dissection -pkt = Ether('\xff\xff\xff\xff\xff\xff\x86\x14\xf0\xc7[.\x88\xd9\x01\x00\x00\x01\xff\xff\xff\xff\xff\xff\x86\x14\xf0\xc7[.\x00\x00\xfe\xe9[\xa9\xaf\xc1\x0bS[\xa9\xaf\xc1\x0bS\x01\x06}[G\x8f\xec.\x02\x04p\x00\x00\x00\x03\x04\x00\x00\x00\x06\x07\x04\xac\x19\x88\xe4\t\x02\x00l\n\x08\x00\x00\x00\x00\x00\x0fB@\x0c\x04\x00\x08=`\x0e\x00\x0f\x0eT\x00E\x00S\x00T\x00-\x00A\x00P\x00\x12\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x04\x00\x00\x00\x00\x15\x01\x02\x18\x00\x19\x02\x04\x00\x1a\x00\x00') +pkt = Ether(b'\xff\xff\xff\xff\xff\xff\x86\x14\xf0\xc7[.\x88\xd9\x01\x00\x00\x01\xff\xff\xff\xff\xff\xff\x86\x14\xf0\xc7[.\x00\x00\xfe\xe9[\xa9\xaf\xc1\x0bS[\xa9\xaf\xc1\x0bS\x01\x06}[G\x8f\xec.\x02\x04p\x00\x00\x00\x03\x04\x00\x00\x00\x06\x07\x04\xac\x19\x88\xe4\t\x02\x00l\n\x08\x00\x00\x00\x00\x00\x0fB@\x0c\x04\x00\x08=`\x0e\x00\x0f\x0eT\x00E\x00S\x00T\x00-\x00A\x00P\x00\x12\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x04\x00\x00\x00\x00\x15\x01\x02\x18\x00\x19\x02\x04\x00\x1a\x00\x00') assert pkt.dst == pkt.real_dst assert pkt.src == pkt.real_src assert pkt.current_mapper_address == pkt.apparent_mapper_address @@ -5085,10 +5085,10 @@ assert plen == payloadlen + TCP/IP tests = TCP options: UTO - basic build -str(TCP(options=[("UTO", 0xffff)])) == "\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff" +str(TCP(options=[("UTO", 0xffff)])) == b"\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff" = TCP options: UTO - basic dissection -uto = TCP("\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff") +uto = TCP(b"\x00\x14\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x60\x02\x20\x00\x00\x00\x00\x00\x1c\x04\xff\xff") uto[TCP].options[0][0] == "UTO" and uto[TCP].options[0][1] == 0xffff = IP, TCP & UDP checksums (these tests highly depend on default values) @@ -5231,25 +5231,25 @@ default link#11 UCSI 1 0 bridge1 def se_popen(command): """Perform specific side effects""" if command.startswith("netstat -rn"): - return StringIO.StringIO(netstat_output) + return StringIO.StringIO(netstat_output) elif command == "ifconfig -l": - ret = StringIO.StringIO(ifconfig_output) - def unit(): - return ret - ret.__call__ = unit - ret.__enter__ = unit - ret.__exit__ = lambda x,y,z: None - return ret - raise Exception("Command not mocked: %s" % command) + ret = StringIO.StringIO(ifconfig_output) + def unit(): + return ret + ret.__call__ = unit + ret.__enter__ = unit + ret.__exit__ = lambda x,y,z: None + return ret + raise Exception("Command not mocked: %s" % command) mock_os.popen.side_effect = se_popen # Mocked get_if_addr() behavior def se_get_if_addr(iface): """Perform specific side effects""" if iface == "bridge1": - oserror_exc = OSError() - oserror_exc.message = "Device not configured" - raise oserror_exc - return "1.2.3.4" + oserror_exc = OSError() + oserror_exc.message = "Device not configured" + raise oserror_exc + return "1.2.3.4" mock_get_if_addr.side_effect = se_get_if_addr # Test the function from scapy.arch.unix import read_routes @@ -5578,39 +5578,39 @@ test_netbsd_7_0() + EAPOL class tests = EAPOL - Basic Instantiation -str(EAPOL()) == '\x01\x00\x00\x00' +str(EAPOL()) == b'\x01\x00\x00\x00' = EAPOL - Instantiation with specific values -str(EAPOL(version = 3, type = 5)) == '\x03\x05\x00\x00' +str(EAPOL(version = 3, type = 5)) == b'\x03\x05\x00\x00' = EAPOL - Dissection (1) -s = '\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 1) assert(eapol.len == 0) = EAPOL - Dissection (2) -s = '\x03\x00\x00\x05\x01\x01\x00\x05\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x03\x00\x00\x05\x01\x01\x00\x05\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 0) assert(eapol.len == 5) = EAPOL - Dissection (3) -s = '\x03\x00\x00\x0e\x02\x01\x00\x0e\x01anonymous\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x03\x00\x00\x0e\x02\x01\x00\x0e\x01anonymous\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 0) assert(eapol.len == 14) = EAPOL - Dissection (4) -req = EAPOL('\x03\x00\x00\x05\x01\x01\x00\x05\x01') -ans = EAPOL('\x03\x00\x00\x0e\x02\x01\x00\x0e\x01anonymous') +req = EAPOL(b'\x03\x00\x00\x05\x01\x01\x00\x05\x01') +ans = EAPOL(b'\x03\x00\x00\x0e\x02\x01\x00\x0e\x01anonymous') ans.answers(req) = EAPOL - Dissection (5) -s = '\x02\x00\x00\x06\x01\x01\x00\x06\r ' +s = b'\x02\x00\x00\x06\x01\x01\x00\x06\r ' eapol = EAPOL(s) assert(eapol.version == 2) assert(eapol.type == 0) @@ -5618,7 +5618,7 @@ assert(eapol.len == 6) assert(eapol.haslayer(EAP_TLS)) = EAPOL - Dissection (6) -s = '\x03\x00\x00<\x02\x9e\x00<+\x01\x16\x03\x01\x001\x01\x00\x00-\x03\x01dr1\x93ZS\x0en\xad\x1f\xbaH\xbb\xfe6\xe6\xd0\xcb\xec\xd7\xc0\xd7\xb9\xa5\xc9\x0c\xfd\x98o\xa7T \x00\x00\x04\x004\x00\x00\x01\x00\x00\x00' +s = b'\x03\x00\x00<\x02\x9e\x00<+\x01\x16\x03\x01\x001\x01\x00\x00-\x03\x01dr1\x93ZS\x0en\xad\x1f\xbaH\xbb\xfe6\xe6\xd0\xcb\xec\xd7\xc0\xd7\xb9\xa5\xc9\x0c\xfd\x98o\xa7T \x00\x00\x04\x004\x00\x00\x01\x00\x00\x00' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 0) @@ -5632,78 +5632,78 @@ assert(eapol.haslayer(EAP_FAST)) = EAPOL-MKA - With Basic parameter set - Dissection eapol = None -s = '\x03\x05\x00T\x01\xff\xf0<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x01\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\xff\x00\x00\x10\xe5\xf5j\x86V\\\xb1\xcc\xa9\xb95\x04m*Cj' +s = b'\x03\x05\x00T\x01\xff\xf0<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x01\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\xff\x00\x00\x10\xe5\xf5j\x86V\\\xb1\xcc\xa9\xb95\x04m*Cj' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 5) assert(eapol.len == 84) assert(eapol.haslayer(MKAPDU)) -assert(eapol[MKAPDU].basic_param_set.actor_member_id == "\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") +assert(eapol[MKAPDU].basic_param_set.actor_member_id == b"\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") assert(eapol[MKAPDU].haslayer(MKAICVSet)) -assert(eapol[MKAPDU][MKAICVSet].icv == "\xe5\xf5j\x86V\\\xb1\xcc\xa9\xb95\x04m*Cj") +assert(eapol[MKAPDU][MKAICVSet].icv == b"\xe5\xf5j\x86V\\\xb1\xcc\xa9\xb95\x04m*Cj") = EAPOL-MKA - With Potential Peer List parameter set - Dissection eapol = None -s = '\x03\x05\x00h\x01\x10\xe0<\xccN$\xc4\xf7\x7f\x00\x80q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00}\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x02\x00\x00\x10\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x01\xff\x00\x00\x105\x01\xdc)\xfd\xd1\xff\xd55\x9c_o\xc9\x9c\xca\xc0' +s = b'\x03\x05\x00h\x01\x10\xe0<\xccN$\xc4\xf7\x7f\x00\x80q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00}\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x02\x00\x00\x10\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x01\xff\x00\x00\x105\x01\xdc)\xfd\xd1\xff\xd55\x9c_o\xc9\x9c\xca\xc0' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 5) assert(eapol.len == 104) assert(eapol.haslayer(MKAPDU)) -assert(eapol[MKAPDU].basic_param_set.actor_member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU].basic_param_set.actor_member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol.haslayer(MKAPotentialPeerListParamSet)) -assert(eapol[MKAPDU][MKAPotentialPeerListParamSet].member_id_message_num[0].member_id == "\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") +assert(eapol[MKAPDU][MKAPotentialPeerListParamSet].member_id_message_num[0].member_id == b"\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") assert(eapol[MKAPDU].haslayer(MKAICVSet)) -assert(eapol[MKAPDU][MKAICVSet].icv == "5\x01\xdc)\xfd\xd1\xff\xd55\x9c_o\xc9\x9c\xca\xc0") +assert(eapol[MKAPDU][MKAICVSet].icv == b"5\x01\xdc)\xfd\xd1\xff\xd55\x9c_o\xc9\x9c\xca\xc0") = EAPOL-MKA - With Live Peer List parameter set - Dissection eapol = None -s = "\x03\x05\x00h\x01\xffp<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x02\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x01\x00\x00\x10q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x80\xff\x00\x00\x10\xf4\xa1d\x18\tD\xa2}\x8e'\x0c/\xda,\xea\xb7" +s = b"\x03\x05\x00h\x01\xffp<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x02\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x01\x00\x00\x10q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x80\xff\x00\x00\x10\xf4\xa1d\x18\tD\xa2}\x8e'\x0c/\xda,\xea\xb7" eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 5) assert(eapol.len == 104) assert(eapol.haslayer(MKAPDU)) -assert(eapol[MKAPDU].basic_param_set.actor_member_id == '\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7') +assert(eapol[MKAPDU].basic_param_set.actor_member_id == b'\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7') assert(eapol.haslayer(MKALivePeerListParamSet)) -assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol[MKAPDU].haslayer(MKAICVSet)) -assert(eapol[MKAPDU][MKAICVSet].icv == "\xf4\xa1d\x18\tD\xa2}\x8e'\x0c/\xda,\xea\xb7") +assert(eapol[MKAPDU][MKAICVSet].icv == b"\xf4\xa1d\x18\tD\xa2}\x8e'\x0c/\xda,\xea\xb7") = EAPOL-MKA - With SAK Use parameter set - Dissection eapol = None -s = '\x03\x05\x00\x94\x01\xffp<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x03\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x03\x10\x00(q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00\x00\x10q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x83\xff\x00\x00\x10OF\x84\xf1@%\x95\xe6Fw9\x1a\xfa\x03(\xae' +s = b'\x03\x05\x00\x94\x01\xffp<\x00Bh\xa8\x1e\x03\x00\n\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x03\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x03\x10\x00(q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00\x00\x10q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x83\xff\x00\x00\x10OF\x84\xf1@%\x95\xe6Fw9\x1a\xfa\x03(\xae' eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 5) assert(eapol.len == 148) assert(eapol.haslayer(MKAPDU)) -assert(eapol[MKAPDU].basic_param_set.actor_member_id == '\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7') +assert(eapol[MKAPDU].basic_param_set.actor_member_id == b'\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7') assert(eapol.haslayer(MKASAKUseParamSet)) -assert(eapol[MKAPDU][MKASAKUseParamSet].latest_key_key_server_member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU][MKASAKUseParamSet].latest_key_key_server_member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol.haslayer(MKALivePeerListParamSet)) -assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol[MKAPDU].haslayer(MKAICVSet)) -assert(eapol[MKAPDU][MKAICVSet].icv == "OF\x84\xf1@%\x95\xe6Fw9\x1a\xfa\x03(\xae") +assert(eapol[MKAPDU][MKAICVSet].icv == b"OF\x84\xf1@%\x95\xe6Fw9\x1a\xfa\x03(\xae") = EAPOL-MKA - With Distributed SAK parameter set - Dissection eapol = None -s = "\x03\x05\x00\xb4\x01\x10\xe0<\xccN$\xc4\xf7\x7f\x00\x80q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x81\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x01\x00\x00\x10\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x02\x03\x10\x00(q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x10\x00\x1c\x00\x00\x00\x01Cz\x05\x88\x9f\xe8-\x94W+?\x13~\xfb\x016yVB?\xbd\xa1\x9fu\xff\x00\x00\x10\xb0H\xcf\xe0:\xa1\x94RD'\x03\xe67\xe1Ur" +s = b"\x03\x05\x00\xb4\x01\x10\xe0<\xccN$\xc4\xf7\x7f\x00\x80q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x81\x00\x80\xc2\x01\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x01\x00\x00\x10\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7\x00\x00\x00\x02\x03\x10\x00(q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x10\x00\x1c\x00\x00\x00\x01Cz\x05\x88\x9f\xe8-\x94W+?\x13~\xfb\x016yVB?\xbd\xa1\x9fu\xff\x00\x00\x10\xb0H\xcf\xe0:\xa1\x94RD'\x03\xe67\xe1Ur" eapol = EAPOL(s) assert(eapol.version == 3) assert(eapol.type == 5) assert(eapol.len == 180) assert(eapol.haslayer(MKAPDU)) -assert(eapol[MKAPDU].basic_param_set.actor_member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU].basic_param_set.actor_member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol.haslayer(MKASAKUseParamSet)) -assert(eapol[MKAPDU][MKASAKUseParamSet].latest_key_key_server_member_id == "q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") +assert(eapol[MKAPDU][MKASAKUseParamSet].latest_key_key_server_member_id == b"q\x8b\x8a9\x86k/X\x14\xc9\xdc\xf6") assert(eapol.haslayer(MKALivePeerListParamSet)) -assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == "\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") +assert(eapol[MKAPDU][MKALivePeerListParamSet].member_id_message_num[0].member_id == b"\xbcj\x00\x96Ywz\x82:\x90\xd9\xe7") assert(eapol.haslayer(MKADistributedSAKParamSet)) -assert(eapol[MKADistributedSAKParamSet].sak_aes_key_wrap == "Cz\x05\x88\x9f\xe8-\x94W+?\x13~\xfb\x016yVB?\xbd\xa1\x9fu") +assert(eapol[MKADistributedSAKParamSet].sak_aes_key_wrap == b"Cz\x05\x88\x9f\xe8-\x94W+?\x13~\xfb\x016yVB?\xbd\xa1\x9fu") assert(eapol[MKAPDU].haslayer(MKAICVSet)) -assert(eapol[MKAPDU][MKAICVSet].icv == "\xb0H\xcf\xe0:\xa1\x94RD'\x03\xe67\xe1Ur") +assert(eapol[MKAPDU][MKAICVSet].icv == b"\xb0H\xcf\xe0:\xa1\x94RD'\x03\xe67\xe1Ur") ############ @@ -5712,13 +5712,13 @@ assert(eapol[MKAPDU][MKAICVSet].icv == "\xb0H\xcf\xe0:\xa1\x94RD'\x03\xe67\xe1Ur + EAP class tests = EAP - Basic Instantiation -str(EAP()) == '\x04\x00\x00\x04' +str(EAP()) == b'\x04\x00\x00\x04' = EAP - Instantiation with specific values -str(EAP(code = 1, id = 1, len = 5, type = 1)) == '\x01\x01\x00\x05\x01' +str(EAP(code = 1, id = 1, len = 5, type = 1)) == b'\x01\x01\x00\x05\x01' = EAP - Dissection (1) -s = '\x01\x01\x00\x05\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x01\x01\x00\x05\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eap = EAP(s) assert(eap.code == 1) assert(eap.id == 1) @@ -5727,7 +5727,7 @@ assert(hasattr(eap, "type")) assert(eap.type == 1) = EAP - Dissection (2) -s = '\x02\x01\x00\x0e\x01anonymous\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x02\x01\x00\x0e\x01anonymous\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 1) @@ -5737,7 +5737,7 @@ assert(hasattr(eap, 'identity')) assert(eap.identity == 'anonymous') = EAP - Dissection (3) -s = '\x01\x01\x00\x06\r ' +s = b'\x01\x01\x00\x06\r ' eap = EAP(s) assert(eap.code == 1) assert(eap.id == 1) @@ -5749,7 +5749,7 @@ assert(eap[EAP_TLS].M == 0) assert(eap[EAP_TLS].S == 1) = EAP - Dissection (4) -s = '\x02\x01\x00\xd1\r\x00\x16\x03\x01\x00\xc6\x01\x00\x00\xc2\x03\x01UK\x02\xdf\x1e\xde5\xab\xfa[\x15\xef\xbe\xa2\xe4`\xc6g\xb9\xa8\xaa%vAs\xb2\x1cXt\x1c0\xb7\x00\x00P\xc0\x14\xc0\n\x009\x008\x00\x88\x00\x87\xc0\x0f\xc0\x05\x005\x00\x84\xc0\x12\xc0\x08\x00\x16\x00\x13\xc0\r\xc0\x03\x00\n\xc0\x13\xc0\t\x003\x002\x00\x9a\x00\x99\x00E\x00D\xc0\x0e\xc0\x04\x00/\x00\x96\x00A\xc0\x11\xc0\x07\xc0\x0c\xc0\x02\x00\x05\x00\x04\x00\x15\x00\x12\x00\t\x00\xff\x01\x00\x00I\x00\x0b\x00\x04\x03\x00\x01\x02\x00\n\x004\x002\x00\x0e\x00\r\x00\x19\x00\x0b\x00\x0c\x00\x18\x00\t\x00\n\x00\x16\x00\x17\x00\x08\x00\x06\x00\x07\x00\x14\x00\x15\x00\x04\x00\x05\x00\x12\x00\x13\x00\x01\x00\x02\x00\x03\x00\x0f\x00\x10\x00\x11\x00#\x00\x00\x00\x0f\x00\x01\x01' +s = b'\x02\x01\x00\xd1\r\x00\x16\x03\x01\x00\xc6\x01\x00\x00\xc2\x03\x01UK\x02\xdf\x1e\xde5\xab\xfa[\x15\xef\xbe\xa2\xe4`\xc6g\xb9\xa8\xaa%vAs\xb2\x1cXt\x1c0\xb7\x00\x00P\xc0\x14\xc0\n\x009\x008\x00\x88\x00\x87\xc0\x0f\xc0\x05\x005\x00\x84\xc0\x12\xc0\x08\x00\x16\x00\x13\xc0\r\xc0\x03\x00\n\xc0\x13\xc0\t\x003\x002\x00\x9a\x00\x99\x00E\x00D\xc0\x0e\xc0\x04\x00/\x00\x96\x00A\xc0\x11\xc0\x07\xc0\x0c\xc0\x02\x00\x05\x00\x04\x00\x15\x00\x12\x00\t\x00\xff\x01\x00\x00I\x00\x0b\x00\x04\x03\x00\x01\x02\x00\n\x004\x002\x00\x0e\x00\r\x00\x19\x00\x0b\x00\x0c\x00\x18\x00\t\x00\n\x00\x16\x00\x17\x00\x08\x00\x06\x00\x07\x00\x14\x00\x15\x00\x04\x00\x05\x00\x12\x00\x13\x00\x01\x00\x02\x00\x03\x00\x0f\x00\x10\x00\x11\x00#\x00\x00\x00\x0f\x00\x01\x01' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 1) @@ -5761,7 +5761,7 @@ assert(eap[EAP_TLS].M == 0) assert(eap[EAP_TLS].S == 0) = EAP - Dissection (5) -s = '\x02\x9e\x00<+\x01\x16\x03\x01\x001\x01\x00\x00-\x03\x01dr1\x93ZS\x0en\xad\x1f\xbaH\xbb\xfe6\xe6\xd0\xcb\xec\xd7\xc0\xd7\xb9\xa5\xc9\x0c\xfd\x98o\xa7T \x00\x00\x04\x004\x00\x00\x01\x00\x00\x00' +s = b'\x02\x9e\x00<+\x01\x16\x03\x01\x001\x01\x00\x00-\x03\x01dr1\x93ZS\x0en\xad\x1f\xbaH\xbb\xfe6\xe6\xd0\xcb\xec\xd7\xc0\xd7\xb9\xa5\xc9\x0c\xfd\x98o\xa7T \x00\x00\x04\x004\x00\x00\x01\x00\x00\x00' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 158) @@ -5774,7 +5774,7 @@ assert(eap[EAP_FAST].S == 0) assert(eap[EAP_FAST].version == 1) = EAP - Dissection (6) -s = '\x02\x9f\x01L+\x01\x16\x03\x01\x01\x06\x10\x00\x01\x02\x01\x00Y\xc9\x8a\tcw\t\xdcbU\xfd\x035\xcd\x1a\t\x10f&[(9\xf6\x88W`\xc6\x0f\xb3\x84\x15\x19\xf5\tk\xbd\x8fp&0\xb0\xa4B\x85\x0c<:s\xf2zT\xc3\xbd\x8a\xe4D{m\xe7\x97\xfe>\xda\x14\xb8T1{\xd7H\x9c\xa6\xcb\xe3,u\xdf\xe0\x82\xe5R\x1e<\xe5\x03}\xeb\x98\xe2\xf7\x8d3\xc6\x83\xac"\x8f\xd7\x12\xe5{:"\x84A\xd9\x14\xc2cZF\xd4\t\xab\xdar\xc7\xe0\x0e\x00o\xce\x05g\xdc?\xcc\xf7\xe83\x83E\xb3>\xe8<3-QB\xfd$C/\x1be\xcf\x03\xd6Q4\xbe\\h\xba)<\x99N\x89\xd9\xb1\xfa!\xd7a\xef\xa3\xd3o\xed8Uz\xb5k\xb0`\xfeC\xbc\xb3aS,d\xe6\xdc\x13\xa4A\x1e\x9b\r{\xd6s \xd0cQ\x95y\xc8\x1d\xc3\xd9\x87\xf2=\x81\x96q~\x99E\xc3\x97\xa8px\xe2\xc7\x92\xeb\xff/v\x84\x1e\xfb\x00\x95#\xba\xfb\xd88h\x90K\xa7\xbd9d\xb4\xf2\xf2\x14\x02vtW\xaa\xadY\x14\x03\x01\x00\x01\x01\x16\x03\x01\x000\x97\xc5l\xd6\xef\xffcM\x81\x90Q\x96\xf6\xfeX1\xf7\xfc\x84\xc6\xa0\xf6Z\xcd\xb6\xe1\xd4\xdb\x88\xf9t%Q!\xe7,~#2G-\xdf\x83\xbf\x86Q\xa2$' +s = b'\x02\x9f\x01L+\x01\x16\x03\x01\x01\x06\x10\x00\x01\x02\x01\x00Y\xc9\x8a\tcw\t\xdcbU\xfd\x035\xcd\x1a\t\x10f&[(9\xf6\x88W`\xc6\x0f\xb3\x84\x15\x19\xf5\tk\xbd\x8fp&0\xb0\xa4B\x85\x0c<:s\xf2zT\xc3\xbd\x8a\xe4D{m\xe7\x97\xfe>\xda\x14\xb8T1{\xd7H\x9c\xa6\xcb\xe3,u\xdf\xe0\x82\xe5R\x1e<\xe5\x03}\xeb\x98\xe2\xf7\x8d3\xc6\x83\xac"\x8f\xd7\x12\xe5{:"\x84A\xd9\x14\xc2cZF\xd4\t\xab\xdar\xc7\xe0\x0e\x00o\xce\x05g\xdc?\xcc\xf7\xe83\x83E\xb3>\xe8<3-QB\xfd$C/\x1be\xcf\x03\xd6Q4\xbe\\h\xba)<\x99N\x89\xd9\xb1\xfa!\xd7a\xef\xa3\xd3o\xed8Uz\xb5k\xb0`\xfeC\xbc\xb3aS,d\xe6\xdc\x13\xa4A\x1e\x9b\r{\xd6s \xd0cQ\x95y\xc8\x1d\xc3\xd9\x87\xf2=\x81\x96q~\x99E\xc3\x97\xa8px\xe2\xc7\x92\xeb\xff/v\x84\x1e\xfb\x00\x95#\xba\xfb\xd88h\x90K\xa7\xbd9d\xb4\xf2\xf2\x14\x02vtW\xaa\xadY\x14\x03\x01\x00\x01\x01\x16\x03\x01\x000\x97\xc5l\xd6\xef\xffcM\x81\x90Q\x96\xf6\xfeX1\xf7\xfc\x84\xc6\xa0\xf6Z\xcd\xb6\xe1\xd4\xdb\x88\xf9t%Q!\xe7,~#2G-\xdf\x83\xbf\x86Q\xa2$' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 159) @@ -5787,7 +5787,7 @@ assert(eap[EAP_FAST].S == 0) assert(eap[EAP_FAST].version == 1) = EAP - Dissection (7) -s = '\x02\xf1\x00\x06\x03+' +s = b'\x02\xf1\x00\x06\x03+' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 241) @@ -5797,7 +5797,7 @@ assert(hasattr(eap, 'desired_auth_type')) assert(eap.desired_auth_type == 43) = EAP - EAP_MD5 - Request - Dissection (8) -s = '\x01\x02\x00\x16\x04\x10\x86\xf9\x89\x94\x81\x01\xb3 nHh\x1b\x8d\xe7^\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x01\x02\x00\x16\x04\x10\x86\xf9\x89\x94\x81\x01\xb3 nHh\x1b\x8d\xe7^\xdb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eap = EAP(s) assert(eap.code == 1) assert(eap.id == 2) @@ -5805,11 +5805,11 @@ assert(eap.len == 22) assert(eap.type == 4) assert(eap.haslayer(EAP_MD5)) assert(eap[EAP_MD5].value_size == 16) -assert(eap[EAP_MD5].value == '\x86\xf9\x89\x94\x81\x01\xb3 nHh\x1b\x8d\xe7^\xdb') +assert(eap[EAP_MD5].value == b'\x86\xf9\x89\x94\x81\x01\xb3 nHh\x1b\x8d\xe7^\xdb') assert(eap[EAP_MD5].optional_name == '') = EAP - EAP_MD5 - Response - Dissection (9) -s = '\x02\x02\x00\x16\x04\x10\xfd\x1e\xffe\xf5\x80y\xa8\xe3\xc8\xf1\xbd\xc2\x85\xae\xcf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x02\x02\x00\x16\x04\x10\xfd\x1e\xffe\xf5\x80y\xa8\xe3\xc8\xf1\xbd\xc2\x85\xae\xcf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' eap = EAP(s) assert(eap.code == 2) assert(eap.id == 2) @@ -5817,7 +5817,7 @@ assert(eap.len == 22) assert(eap.type == 4) assert(eap.haslayer(EAP_MD5)) assert(eap[EAP_MD5].value_size == 16) -assert(eap[EAP_MD5].value == '\xfd\x1e\xffe\xf5\x80y\xa8\xe3\xc8\xf1\xbd\xc2\x85\xae\xcf') +assert(eap[EAP_MD5].value == b'\xfd\x1e\xffe\xf5\x80y\xa8\xe3\xc8\xf1\xbd\xc2\x85\xae\xcf') assert(eap[EAP_MD5].optional_name == '') ############ @@ -5860,7 +5860,7 @@ len(str(NTP())) == 48 = NTPHeader - Dissection -s = "!\x0b\x06\xea\x00\x00\x00\x00\x00\x00\xf2\xc1\x7f\x7f\x01\x00\xdb9\xe8\xa21\x02\xe6\xbc\xdb9\xe8\x81\x02U8\xef\xdb9\xe8\x80\xdcl+\x06\xdb9\xe8\xa91\xcbI\xbf\x00\x00\x00\x01\xady\xf3\xa1\xe5\xfc\xd02\xd2j\x1e'\xc3\xc1\xb6\x0e" +s = b"!\x0b\x06\xea\x00\x00\x00\x00\x00\x00\xf2\xc1\x7f\x7f\x01\x00\xdb9\xe8\xa21\x02\xe6\xbc\xdb9\xe8\x81\x02U8\xef\xdb9\xe8\x80\xdcl+\x06\xdb9\xe8\xa91\xcbI\xbf\x00\x00\x00\x01\xady\xf3\xa1\xe5\xfc\xd02\xd2j\x1e'\xc3\xc1\xb6\x0e" p = NTP(s) assert(isinstance(p, NTPHeader)) assert(p[NTPAuthenticator].key_id == 1) @@ -5868,7 +5868,7 @@ assert(p[NTPAuthenticator].dgst.encode("hex") == 'ad79f3a1e5fcd032d26a1e27c3c1b6 = NTPHeader - KoD -s = '\xe4\x00\x06\xe8\x00\x00\x00\x00\x00\x00\x02\xcaINIT\x00\x00\x00\x00\x00\x00\x00\x00\xdb@\xe3\x9eH\xa3pj\xdb@\xe3\x9eH\xf0\xc3\\\xdb@\xe3\x9eH\xfaL\xac\x00\x00\x00\x01B\x86)\xc1Q4\x8bW8\xe7Q\xda\xd0Z\xbc\xb8' +s = b'\xe4\x00\x06\xe8\x00\x00\x00\x00\x00\x00\x02\xcaINIT\x00\x00\x00\x00\x00\x00\x00\x00\xdb@\xe3\x9eH\xa3pj\xdb@\xe3\x9eH\xf0\xc3\\\xdb@\xe3\x9eH\xfaL\xac\x00\x00\x00\x01B\x86)\xc1Q4\x8bW8\xe7Q\xda\xd0Z\xbc\xb8' p = NTP(s) assert(isinstance(p, NTPHeader)) assert(p.leap == 3) @@ -5879,7 +5879,7 @@ assert(p.ref_id == 'INIT') = NTPHeader - Extension dissection test -s = '#\x02\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\xdbM\xdf\x19e\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdbM\xdf\x19e\x89\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'#\x02\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\xdbM\xdf\x19e\x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdbM\xdf\x19e\x89\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPHeader)) assert(p.leap == 0) @@ -5893,7 +5893,7 @@ assert(p.stratum == 2) + NTP Control (mode 6) tests = NTP Control (mode 6) - CTL_OP_READSTAT (1) - request -s = '\x16\x01\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x16\x01\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -5911,7 +5911,7 @@ assert(p.data == '') = NTP Control (mode 6) - CTL_OP_READSTAT (2) - response -s = '\x16\x81\x00\x0c\x06d\x00\x00\x00\x00\x00\x04\xe5\xfc\xf6$' +s = b'\x16\x81\x00\x0c\x06d\x00\x00\x00\x00\x00\x04\xe5\xfc\xf6$' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -5943,7 +5943,7 @@ assert(p.data.peer_status.peer_event_code == 4) = NTP Control (mode 6) - CTL_OP_READVAR (1) - request -s = '\x16\x02\x00\x12\x00\x00\xfc\x8f\x00\x00\x00\x00' +s = b'\x16\x02\x00\x12\x00\x00\xfc\x8f\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -5957,7 +5957,7 @@ assert(p.data == '') = NTP Control (mode 6) - CTL_OP_READVAR (2) - reponse (1st packet) -s = '\xd6\xa2\x00\x12\xc0\x11\xfc\x8f\x00\x00\x01\xd4srcadr=192.168.122.1, srcport=123, dstadr=192.168.122.100, dstport=123,\r\nleap=3, stratum=16, precision=-24, rootdelay=0.000, rootdisp=0.000,\r\nrefid=INIT, reftime=0x00000000.00000000, rec=0x00000000.00000000,\r\nreach=0x0, unreach=5, hmode=1, pmode=0, hpoll=6, ppoll=10, headway=62,\r\nflash=0x1200, keyid=1, offset=0.000, delay=0.000, dispersion=15937.500,\r\njitter=0.000, xleave=0.240,\r\nfiltdelay= 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00,\r\nfiltoffset= 0.00 0.00 0.00 0.00 ' +s = b'\xd6\xa2\x00\x12\xc0\x11\xfc\x8f\x00\x00\x01\xd4srcadr=192.168.122.1, srcport=123, dstadr=192.168.122.100, dstport=123,\r\nleap=3, stratum=16, precision=-24, rootdelay=0.000, rootdisp=0.000,\r\nrefid=INIT, reftime=0x00000000.00000000, rec=0x00000000.00000000,\r\nreach=0x0, unreach=5, hmode=1, pmode=0, hpoll=6, ppoll=10, headway=62,\r\nflash=0x1200, keyid=1, offset=0.000, delay=0.000, dispersion=15937.500,\r\njitter=0.000, xleave=0.240,\r\nfiltdelay= 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00,\r\nfiltoffset= 0.00 0.00 0.00 0.00 ' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -5982,7 +5982,7 @@ assert(p.data.load == 'srcadr=192.168.122.1, srcport=123, dstadr=192.168.122.100 = NTP Control (mode 6) - CTL_OP_READVAR (3) - reponse (2nd packet) -s = '\xd6\x82\x00\x12\xc0\x11\xfc\x8f\x01\xd4\x00i0.00 0.00 0.00 0.00,\r\nfiltdisp= 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00\r\n\x00\x00\x00' +s = b'\xd6\x82\x00\x12\xc0\x11\xfc\x8f\x01\xd4\x00i0.00 0.00 0.00 0.00,\r\nfiltdisp= 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00\r\n\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -5996,11 +5996,11 @@ assert(isinstance(p.status_word, NTPPeerStatusPacket)) assert(p.association_id == 64655) assert(p.offset == 468) assert(p.count == 105) -assert(p.data.load == '0.00 0.00 0.00 0.00,\r\nfiltdisp= 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00\r\n\x00\x00\x00') +assert(p.data.load == b'0.00 0.00 0.00 0.00,\r\nfiltdisp= 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00 16000.00\r\n\x00\x00\x00') = NTP Control (mode 6) - CTL_OP_READVAR (4) - request -s = '\x16\x02\x00\x13\x00\x00s\xb5\x00\x00\x00\x0btest1,test2\x00\x00\x00\x00\x01=\xc2;\xc7\xed\xb9US9\xd6\x89\x08\xc8\xaf\xa6\x12' +s = b'\x16\x02\x00\x13\x00\x00s\xb5\x00\x00\x00\x0btest1,test2\x00\x00\x00\x00\x01=\xc2;\xc7\xed\xb9US9\xd6\x89\x08\xc8\xaf\xa6\x12' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6015,7 +6015,7 @@ assert(p.authenticator.dgst.encode("hex") == '3dc23bc7edb9555339d68908c8afa612') = NTP Control (mode 6) - CTL_OP_READVAR (5) - response -s = '\xd6\xc2\x00\x13\x05\x00s\xb5\x00\x00\x00\x00\x00\x00\x00\x01\x97(\x02I\xdb\xa0s8\xedr(`\xdbJX\n' +s = b'\xd6\xc2\x00\x13\x05\x00s\xb5\x00\x00\x00\x00\x00\x00\x00\x01\x97(\x02I\xdb\xa0s8\xedr(`\xdbJX\n' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6030,7 +6030,7 @@ assert(p.authenticator.dgst.encode("hex") == '97280249dba07338ed722860db4a580a') = NTP Control (mode 6) - CTL_OP_WRITEVAR (1) - request -s = '\x16\x03\x00\x11\x00\x00\x00\x00\x00\x00\x00\x0btest1,test2\x00\x00\x00\x00\x01\xaf\xf1\x0c\xb4\xc9\x94m\xfcM\x90\tJ\xa1p\x94J' +s = b'\x16\x03\x00\x11\x00\x00\x00\x00\x00\x00\x00\x0btest1,test2\x00\x00\x00\x00\x01\xaf\xf1\x0c\xb4\xc9\x94m\xfcM\x90\tJ\xa1p\x94J' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6045,7 +6045,7 @@ assert(p.authenticator.dgst.encode("hex") == 'aff10cb4c9946dfc4d90094aa170944a') = NTP Control (mode 6) - CTL_OP_WRITEVAR (2) - response -s = '\xd6\xc3\x00\x11\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x80z\x80\xfb\xaf\xc4pg\x98S\xa8\xe5xe\x81\x1c' +s = b'\xd6\xc3\x00\x11\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x80z\x80\xfb\xaf\xc4pg\x98S\xa8\xe5xe\x81\x1c' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6063,7 +6063,7 @@ assert(p.authenticator.dgst.encode("hex") == '807a80fbafc470679853a8e57865811c') = NTP Control (mode 6) - CTL_OP_CONFIGURE (1) - request -s = '\x16\x08\x00\x16\x00\x00\x00\x00\x00\x00\x00\x0ccontrolkey 1\x00\x00\x00\x01\xea\xa7\xac\xa8\x1bj\x9c\xdbX\xe1S\r6\xfb\xef\xa4' +s = b'\x16\x08\x00\x16\x00\x00\x00\x00\x00\x00\x00\x0ccontrolkey 1\x00\x00\x00\x01\xea\xa7\xac\xa8\x1bj\x9c\xdbX\xe1S\r6\xfb\xef\xa4' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6079,7 +6079,7 @@ assert(p.authenticator.dgst.encode("hex") == 'eaa7aca81b6a9cdb58e1530d36fbefa4') = NTP Control (mode 6) - CTL_OP_CONFIGURE (2) - response -s = '\xd6\x88\x00\x16\x00\x00\x00\x00\x00\x00\x00\x12Config Succeeded\r\n\x00\x00\x00\x00\x00\x01\xbf\xa6\xd8_\xf9m\x1e2l)<\xac\xee\xc2\xa59' +s = b'\xd6\x88\x00\x16\x00\x00\x00\x00\x00\x00\x00\x12Config Succeeded\r\n\x00\x00\x00\x00\x00\x01\xbf\xa6\xd8_\xf9m\x1e2l)<\xac\xee\xc2\xa59' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6089,13 +6089,13 @@ assert(p.err == 0) assert(p.more == 0) assert(p.op_code == 8) assert(p.count == 18) -assert(p.data.load == 'Config Succeeded\r\n\x00\x00') +assert(p.data.load == b'Config Succeeded\r\n\x00\x00') assert(p.authenticator.key_id == 1) assert(p.authenticator.dgst.encode("hex") == 'bfa6d85ff96d1e326c293caceec2a539') = NTP Control (mode 6) - CTL_OP_SAVECONFIG (1) - request -s = '\x16\t\x00\x1d\x00\x00\x00\x00\x00\x00\x00\x0fntp.test.2.conf\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc9\xfb\x8a\xbe<`_\xfa6\xd2\x18\xc3\xb7d\x89#' +s = b'\x16\t\x00\x1d\x00\x00\x00\x00\x00\x00\x00\x0fntp.test.2.conf\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc9\xfb\x8a\xbe<`_\xfa6\xd2\x18\xc3\xb7d\x89#' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6105,13 +6105,13 @@ assert(p.err == 0) assert(p.more == 0) assert(p.op_code == 9) assert(p.count == 15) -assert(p.data.load == 'ntp.test.2.conf\x00') +assert(p.data.load == b'ntp.test.2.conf\x00') assert(p.authenticator.key_id == 1) assert(p.authenticator.dgst.encode("hex") == 'c9fb8abe3c605ffa36d218c3b7648923') = NTP Control (mode 6) - CTL_OP_SAVECONFIG (2) - response -s = "\xd6\x89\x00\x1d\x00\x00\x00\x00\x00\x00\x00*Configuration saved to 'ntp.test.2.conf'\r\n\x00\x00\x00\x00\x00\x012\xc2\xbaY\xc53\xfe(\xf5P\xe5\xa0\x86\x02\x95\xd9" +s = b"\xd6\x89\x00\x1d\x00\x00\x00\x00\x00\x00\x00*Configuration saved to 'ntp.test.2.conf'\r\n\x00\x00\x00\x00\x00\x012\xc2\xbaY\xc53\xfe(\xf5P\xe5\xa0\x86\x02\x95\xd9" p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6121,13 +6121,13 @@ assert(p.err == 0) assert(p.more == 0) assert(p.op_code == 9) assert(p.count == 42) -assert(p.data.load == "Configuration saved to 'ntp.test.2.conf'\r\n\x00\x00") +assert(p.data.load == b"Configuration saved to 'ntp.test.2.conf'\r\n\x00\x00") assert(p.authenticator.key_id == 1) assert(p.authenticator.dgst.encode("hex") == '32c2ba59c533fe28f550e5a0860295d9') = NTP Control (mode 6) - CTL_OP_REQ_NONCE (1) - request -s = '\x16\x0c\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x16\x0c\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6141,7 +6141,7 @@ assert(p.authenticator == '') = NTP Control (mode 6) - CTL_OP_REQ_NONCE (2) - response -s = '\xd6\x8c\x00\x07\x00\x00\x00\x00\x00\x00\x00 nonce=db4186a2e1d9022472e24bc9\r\n' +s = b'\xd6\x8c\x00\x07\x00\x00\x00\x00\x00\x00\x00 nonce=db4186a2e1d9022472e24bc9\r\n' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6155,7 +6155,7 @@ assert(p.authenticator == '') = NTP Control (mode 6) - CTL_OP_READ_MRU (1) - request -s = '\x16\n\x00\x08\x00\x00\x00\x00\x00\x00\x00(nonce=db4186a2e1d9022472e24bc9, frags=32' +s = b'\x16\n\x00\x08\x00\x00\x00\x00\x00\x00\x00(nonce=db4186a2e1d9022472e24bc9, frags=32' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6168,7 +6168,7 @@ assert(p.data.load == 'nonce=db4186a2e1d9022472e24bc9, frags=32') assert(p.authenticator == '') = NTP Control (mode 6) - CTL_OP_READ_MRU (2) - response -s = '\xd6\x8a\x00\x08\x00\x00\x00\x00\x00\x00\x00\xe9nonce=db4186a2e2073198b93c6419, addr.0=192.168.122.100:123,\r\nfirst.0=0xdb418673.323e1a89, last.0=0xdb418673.323e1a89, ct.0=1,\r\nmv.0=36, rs.0=0x0, WWQ.0=18446744073709509383, now=0xdb4186a2.e20ff8f4,\r\nlast.newest=0xdb418673.323e1a89\r\n\x00\x00\x00' +s = b'\xd6\x8a\x00\x08\x00\x00\x00\x00\x00\x00\x00\xe9nonce=db4186a2e2073198b93c6419, addr.0=192.168.122.100:123,\r\nfirst.0=0xdb418673.323e1a89, last.0=0xdb418673.323e1a89, ct.0=1,\r\nmv.0=36, rs.0=0x0, WWQ.0=18446744073709509383, now=0xdb4186a2.e20ff8f4,\r\nlast.newest=0xdb418673.323e1a89\r\n\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPControl)) assert(p.version == 2) @@ -6177,7 +6177,7 @@ assert(p.response == 1) assert(p.err == 0) assert(p.op_code == 10) assert(p.count == 233) -assert(p.data.load == 'nonce=db4186a2e2073198b93c6419, addr.0=192.168.122.100:123,\r\nfirst.0=0xdb418673.323e1a89, last.0=0xdb418673.323e1a89, ct.0=1,\r\nmv.0=36, rs.0=0x0, WWQ.0=18446744073709509383, now=0xdb4186a2.e20ff8f4,\r\nlast.newest=0xdb418673.323e1a89\r\n\x00\x00\x00') +assert(p.data.load == b'nonce=db4186a2e2073198b93c6419, addr.0=192.168.122.100:123,\r\nfirst.0=0xdb418673.323e1a89, last.0=0xdb418673.323e1a89, ct.0=1,\r\nmv.0=36, rs.0=0x0, WWQ.0=18446744073709509383, now=0xdb4186a2.e20ff8f4,\r\nlast.newest=0xdb418673.323e1a89\r\n\x00\x00\x00') assert(p.authenticator == '') @@ -6186,7 +6186,7 @@ assert(p.authenticator == '') + NTP Private (mode 7) tests = NTP Private (mode 7) - error - Dissection -s = '\x97\x00\x03\x1d@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x1d@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6199,7 +6199,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_PEER_LIST (1) - request -s = '\x17\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6211,7 +6211,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_PEER_LIST (2) - response -s = '\x97\x00\x03\x00\x00\x01\x00 \x7f\x7f\x01\x00\x00{\x03\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x00\x00\x01\x00 \x7f\x7f\x01\x00\x00{\x03\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6226,7 +6226,7 @@ assert(p.data[0].port) == 123 = NTP Private (mode 7) - REQ_PEER_INFO (1) - request -s = '\x17\x00\x03\x02\x00\x01\x00 \xc0\xa8zf\x00{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x02\x00\x01\x00 \xc0\xa8zf\x00{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6241,7 +6241,7 @@ assert(p.req_data[0].port == 123) = NTP Private (mode 7) - REQ_PEER_INFO (2) - response -s = '\x97\x00\x03\x02\x00\x01\x01\x18\xc0\xa8zf\xc0\xa8ze\x00{\x01\x03\x01\x00\x10\x06\n\xea\x04\x00\x00\xaf"\x00"\x16\x04\xb3\x01\x00\x00\x00\x00\x00\x00\x00INIT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x82\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb<\x8d\xc5\xde\x7fB\x89\xdb<\x8d\xc5\xde\x7fB\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x02\x00\x01\x01\x18\xc0\xa8zf\xc0\xa8ze\x00{\x01\x03\x01\x00\x10\x06\n\xea\x04\x00\x00\xaf"\x00"\x16\x04\xb3\x01\x00\x00\x00\x00\x00\x00\x00INIT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x82\x9d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb<\x8d\xc5\xde\x7fB\x89\xdb<\x8d\xc5\xde\x7fB\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6257,7 +6257,7 @@ assert(p.data[0].keyid == 1) = NTP Private (mode 7) - REQ_PEER_LIST_SUM (1) - request -s = '\x17\x00\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6267,7 +6267,7 @@ assert(p.request_code == 1) = NTP Private (mode 7) - REQ_PEER_LIST_SUM (2) - response (1st packet) -s = '\xd7\x00\x03\x01\x00\x06\x00H\n\x00\x02\x0f\xc0\x00\x02\x01\x00{\x10\x06\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\x00\x02\x02\x00{\x10\x06\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\xa8d\x01\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\xc0\xa8zg\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\xa8d\x02\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x02\xc0\xa8zh\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\n\x00\x02\x0f\xc0\xa8d\r\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zk\x00{\x01\x01\xc0\xa8ze\xc0\xa8zf\x00{\x0b\x06\x07\xf4\x83\x01\x00\x00\x07\x89\x00\x00\x00\x007\xb1\x00h\x00\x00o?\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zm\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\xd7\x00\x03\x01\x00\x06\x00H\n\x00\x02\x0f\xc0\x00\x02\x01\x00{\x10\x06\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\x00\x02\x02\x00{\x10\x06\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\xa8d\x01\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\xc0\xa8zg\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\x0f\xc0\xa8d\x02\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x02\xc0\xa8zh\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\n\x00\x02\x0f\xc0\xa8d\r\x00{\x10\x07\n\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zk\x00{\x01\x01\xc0\xa8ze\xc0\xa8zf\x00{\x0b\x06\x07\xf4\x83\x01\x00\x00\x07\x89\x00\x00\x00\x007\xb1\x00h\x00\x00o?\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zm\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6280,7 +6280,7 @@ assert(p.data[0].srcaddr == "192.0.2.1") = NTP Private (mode 7) - REQ_PEER_LIST_SUM (3) - response (2nd packet) -s = '\xd7\x01\x03\x01\x00\x06\x00H\xc0\xa8ze\xc0\xa8zg\x00{\x10\x08\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zg\x00{\x10\x08\n\x00\x11\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zh\x00{\x10\x08\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\xc0\xa8zg\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zi\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x02\xc0\xa8zh\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc0\xa8ze\xc0\xa8zj\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zk\x00{\x01\x01\xc0\xa8ze\xc0\xa8zk\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zm\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\xd7\x01\x03\x01\x00\x06\x00H\xc0\xa8ze\xc0\xa8zg\x00{\x10\x08\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zg\x00{\x10\x08\n\x00\x11\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zh\x00{\x10\x08\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\xc0\xa8zg\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zi\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x02\xc0\xa8zh\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc0\xa8ze\xc0\xa8zj\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zk\x00{\x01\x01\xc0\xa8ze\xc0\xa8zk\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8zm\x00{\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) @@ -6294,7 +6294,7 @@ assert(p.data[0].srcaddr == "192.168.122.103") = NTP Private (mode 7) - REQ_PEER_LIST_SUM (3) - response (3rd packet) -s = '\x97\x02\x03\x01\x00\x02\x00H\xc0\xa8ze\xc0\xa8zl\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zm\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x02\x03\x01\x00\x02\x00H\xc0\xa8ze\xc0\xa8zl\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8ze\xc0\xa8zm\x00{\x10\x07\n\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xfd\xff\x00\x00\x00\x00\x00\x00\x01\x02\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) @@ -6308,7 +6308,7 @@ assert(p.data[0].srcaddr == "192.168.122.108") = NTP Private (mode 7) - REQ_PEER_STATS (1) - request -s = '\x17\x00\x03\x03\x00\x01\x00 \xc0\xa8ze\x00{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x03\x00\x01\x00 \xc0\xa8ze\x00{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6320,7 +6320,7 @@ assert(isinstance(p.req_data[0], NTPInfoPeerList)) = NTP Private (mode 7) - REQ_PEER_STATS (2) - response -s = '\x97\x00\x03\x03\x00\x01\x00x\xc0\xa8zf\xc0\xa8ze\x00{\x00\x01\x01\x00\x10\x06\x00\x00\x00)\x00\x00\x00\x1e\x00\x02\xda|\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nJ\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\xde\x7fB\x89\x00<\x8d\xc5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x03\x00\x01\x00x\xc0\xa8zf\xc0\xa8ze\x00{\x00\x01\x01\x00\x10\x06\x00\x00\x00)\x00\x00\x00\x1e\x00\x02\xda|\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\nJ\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\xde\x7fB\x89\x00<\x8d\xc5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) @@ -6333,7 +6333,7 @@ assert(isinstance(x, NTPInfoPeerStats) for x in p.data) = NTP Private (mode 7) - REQ_SYS_INFO (1) - request -s = '\x17\x00\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) @@ -6345,7 +6345,7 @@ assert(p.request_code == 4) = NTP Private (mode 7) - REQ_SYS_INFO (2) - response -s = '\x97\x00\x03\x04\x00\x01\x00P\x7f\x7f\x01\x00\x03\x00\x0b\xf0\x00\x00\x00\x00\x00\x00\x03\x06\x7f\x7f\x01\x00\xdb<\xca\xf3\xa1\x92\xe1\xf7\x06\x00\x00\x00\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\xde\x7fB\x89\x00<\x8d\xc5' +s = b'\x97\x00\x03\x04\x00\x01\x00P\x7f\x7f\x01\x00\x03\x00\x0b\xf0\x00\x00\x00\x00\x00\x00\x03\x06\x7f\x7f\x01\x00\xdb<\xca\xf3\xa1\x92\xe1\xf7\x06\x00\x00\x00\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x07\x00\x00\x00\x00\xde\x7fB\x89\x00<\x8d\xc5' p = NTP(s) assert(isinstance(p, NTPPrivate)) @@ -6364,7 +6364,7 @@ assert(p.data[0].refid == "127.127.1.0") = NTP Private (mode 7) - REQ_SYS_STATS (1) - request -s = '\x17\x00\x03\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6375,7 +6375,7 @@ assert(p.request_code == 5) = NTP Private (mode 7) - REQ_SYS_STATS (2) - response -s = '\x97\x00\x03\x05\x00\x01\x00,\x00\x02\xe2;\x00\x02\xe2;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b%\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b%\x00\x00\x00\x00\x00\x00\x0b=\x00\x00\x00\x00' +s = b'\x97\x00\x03\x05\x00\x01\x00,\x00\x02\xe2;\x00\x02\xe2;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b%\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b%\x00\x00\x00\x00\x00\x00\x0b=\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6389,7 +6389,7 @@ assert(p.data[0].received == 2877) = NTP Private (mode 7) - REQ_IO_STATS (1) - request -s = '\x17\x00\x03\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6400,7 +6400,7 @@ assert(p.request_code == 6) = NTP Private (mode 7) - REQ_IO_STATS (2) - response -s = '\x97\x00\x03\x06\x00\x01\x00(\x00\x00\x03\x04\x00\n\x00\t\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00J\x00\x00\x00\xd9\x00\x00\x00\x00\x00\x00\x00J\x00\x00\x00J' +s = b'\x97\x00\x03\x06\x00\x01\x00(\x00\x00\x03\x04\x00\n\x00\t\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00J\x00\x00\x00\xd9\x00\x00\x00\x00\x00\x00\x00J\x00\x00\x00J' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6413,7 +6413,7 @@ assert(p.data[0].sent == 217) = NTP Private (mode 7) - REQ_MEM_STATS (1) - request -s = '\x17\x00\x03\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6424,7 +6424,7 @@ assert(p.request_code == 7) = NTP Private (mode 7) - REQ_MEM_STATS (2) - response -s = '\x97\x00\x03\x07\x00\x01\x00\x94\x00\x00\n\xee\x00\x0f\x00\r\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x07\x00\x01\x00\x94\x00\x00\n\xee\x00\x0f\x00\r\x00\x00\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6440,7 +6440,7 @@ assert(p.data[0].hashcount[25] == 1 and p.data[0].hashcount[89] == 1) = NTP Private (mode 7) - REQ_LOOP_INFO (1) - request -s = '\x17\x00\x03\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6451,7 +6451,7 @@ assert(p.request_code == 8) = NTP Private (mode 7) - REQ_LOOP_INFO (2) - response -s = '\x97\x00\x03\x08\x00\x01\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x04' +s = b'\x97\x00\x03\x08\x00\x01\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x04' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6465,7 +6465,7 @@ assert(p.data[0].watchdog_timer == 4) = NTP Private (mode 7) - REQ_TIMER_STATS (1) - request -s = '\x17\x00\x03\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6476,7 +6476,7 @@ assert(p.request_code == 9) = NTP Private (mode 7) - REQ_TIMER_STATS (2) - response -s = '\x97\x00\x03\t\x00\x01\x00\x10\x00\x00\x01h\x00\x00\x01h\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\t\x00\x01\x00\x10\x00\x00\x01h\x00\x00\x01h\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6489,7 +6489,7 @@ assert(p.data[0].alarms == 360) = NTP Private (mode 7) - REQ_CONFIG (1) - request -s = '\x17\x80\x03\n\x00\x01\x00\xa8\xc0\xa8zm\x01\x03\x06\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xec\x93\xb1\xa8\xa0a\x00\x00\x00\x01Z\xba\xfe\x01\x1cr\x05d\xa1\x14\xb1)\xe9vD\x8d' +s = b'\x17\x80\x03\n\x00\x01\x00\xa8\xc0\xa8zm\x01\x03\x06\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xec\x93\xb1\xa8\xa0a\x00\x00\x00\x01Z\xba\xfe\x01\x1cr\x05d\xa1\x14\xb1)\xe9vD\x8d' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6512,7 +6512,7 @@ assert(p.authenticator.dgst.encode("hex") == '5abafe011c720564a114b129e976448d') = NTP Private (mode 7) - REQ_CONFIG (2) - response -s = '\x97\x00\x03\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6527,7 +6527,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_UNCONFIG (1) - request -s = '\x17\x80\x03\x0b\x00\x01\x00\x18\xc0\xa8zk\x00\x00\x00\x00X\x88P\xb1\xff\x7f\x00\x008\x88P\xb1\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0\x1bq\xc8\xe5\xa6\x00\x00\x00\x01\x1dM;\xfeZ~]Z\xe3Ea\x92\x9aE\xd8%' +s = b'\x17\x80\x03\x0b\x00\x01\x00\x18\xc0\xa8zk\x00\x00\x00\x00X\x88P\xb1\xff\x7f\x00\x008\x88P\xb1\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0\x1bq\xc8\xe5\xa6\x00\x00\x00\x01\x1dM;\xfeZ~]Z\xe3Ea\x92\x9aE\xd8%' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6547,7 +6547,7 @@ assert(p.authenticator.dgst.encode("hex") == '1d4d3bfe5a7e5d5ae34561929a45d825') = NTP Private (mode 7) - REQ_UNCONFIG (2) - response -s = '\x97\x00\x03\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6562,7 +6562,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_RESADDFLAGS (1) - request -s = '\x17\x80\x03\x11\x00\x01\x000\xc0\xa8zi\xff\xff\xff\xff\x04\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0V\xa9"\xe6_\x00\x00\x00\x01>=\xb70Tp\xee\xae\xe1\xad4b\xef\xe3\x80\xc8' +s = b'\x17\x80\x03\x11\x00\x01\x000\xc0\xa8zi\xff\xff\xff\xff\x04\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0V\xa9"\xe6_\x00\x00\x00\x01>=\xb70Tp\xee\xae\xe1\xad4b\xef\xe3\x80\xc8' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6582,7 +6582,7 @@ assert(p.authenticator.dgst.encode("hex") == '3e3db7305470eeaee1ad3462efe380c8') = NTP Private (mode 7) - REQ_RESSUBFLAGS (1) - request -s = '\x17\x80\x03\x12\x00\x01\x000\xc0\xa8zi\xff\xff\xff\xff\x00\x10\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0F\xe0C\xa9@\x00\x00\x00\x01>e\r\xdf\xdb\x1e1h\xd0\xca)L\x07k\x90\n' +s = b'\x17\x80\x03\x12\x00\x01\x000\xc0\xa8zi\xff\xff\xff\xff\x00\x10\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xf0F\xe0C\xa9@\x00\x00\x00\x01>e\r\xdf\xdb\x1e1h\xd0\xca)L\x07k\x90\n' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6602,7 +6602,7 @@ assert(p.authenticator.dgst.encode("hex") == '3e650ddfdb1e3168d0ca294c076b900a') = NTP Private (mode 7) - REQ_RESET_PEER (1) - request -s = "\x17\x80\x03\x16\x00\x01\x00\x18\xc0\xa8zf\x00\x00\x00\x00X\x88P\xb1\xff\x7f\x00\x008\x88P\xb1\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xef!\x99\x88\xa3\xf1\x00\x00\x00\x01\xb1\xff\xe8\xefB=\xa9\x96\xdc\xe3\x13'\xb3\xfc\xc2\xf5" +s = b"\x17\x80\x03\x16\x00\x01\x00\x18\xc0\xa8zf\x00\x00\x00\x00X\x88P\xb1\xff\x7f\x00\x008\x88P\xb1\xff\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xef!\x99\x88\xa3\xf1\x00\x00\x00\x01\xb1\xff\xe8\xefB=\xa9\x96\xdc\xe3\x13'\xb3\xfc\xc2\xf5" p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6619,7 +6619,7 @@ assert(p.req_data[0].v6_flag == 0) = NTP Private (mode 7) - REQ_AUTHINFO (1) - response -s = '\x97\x00\x03\x1c\x00\x01\x00$\x00\x00\x01\xdd\x00\x00\x00\x02\x00\x00\x00\n\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00/\x00\x00\x00\x00\x00\x00\x00\x01' +s = b'\x97\x00\x03\x1c\x00\x01\x00$\x00\x00\x01\xdd\x00\x00\x00\x02\x00\x00\x00\n\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00/\x00\x00\x00\x00\x00\x00\x00\x01' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6645,7 +6645,7 @@ assert(p.data[0].keyuncached == 1) = NTP Private (mode 7) - REQ_ADD_TRAP (1) - request -s = '\x17\x80\x03\x1e\x00\x01\x000\x00\x00\x00\x00\xc0\x00\x02\x03H\x0f\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xedB\xdd\xda\x7f\x97\x00\x00\x00\x01b$\xb8IM.\xa61\xd0\x85I\x8f\xa7\'\x89\x92' +s = b'\x17\x80\x03\x1e\x00\x01\x000\x00\x00\x00\x00\xc0\x00\x02\x03H\x0f\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xedB\xdd\xda\x7f\x97\x00\x00\x00\x01b$\xb8IM.\xa61\xd0\x85I\x8f\xa7\'\x89\x92' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6665,7 +6665,7 @@ assert(p.authenticator.dgst.encode("hex") == '6224b8494d2ea631d085498fa7278992') = NTP Private (mode 7) - REQ_ADD_TRAP (2) - response -s = '\x97\x00\x03\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6680,7 +6680,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_CLR_TRAP (1) - request -s = '\x17\x80\x03\x1f\x00\x01\x000\x00\x00\x00\x00\xc0\x00\x02\x03H\x0f\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xedb\xb3\x18\x1c\x00\x00\x00\x00\x01\xa5_V\x9e\xb8qD\x92\x1b\x1c>Z\xad]*\x89' +s = b'\x17\x80\x03\x1f\x00\x01\x000\x00\x00\x00\x00\xc0\x00\x02\x03H\x0f\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xedb\xb3\x18\x1c\x00\x00\x00\x00\x01\xa5_V\x9e\xb8qD\x92\x1b\x1c>Z\xad]*\x89' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6700,7 +6700,7 @@ assert(p.authenticator.dgst.encode("hex") == 'a55f569eb87144921b1c3e5aad5d2a89') = NTP Private (mode 7) - REQ_CLR_TRAP (2) - response -s = '\x97\x00\x03\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6715,7 +6715,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_GET_CTLSTATS - response -s = '\x97\x00\x03"\x00\x01\x00<\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03"\x00\x01\x00<\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6731,7 +6731,7 @@ assert(p.data[0].ctltimereset == 237) = NTP Private (mode 7) - REQ_GET_KERNEL (1) - request -s = '\x17\x00\x03&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6745,7 +6745,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_GET_KERNEL (2) - response -s = '\x97\x00\x03&\x00\x01\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4$\x00\x00\xf4$\x00 A\x00\x00\x00\x00\x00\x03\x00\x00\x00\x01\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x97\x00\x03&\x00\x01\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4$\x00\x00\xf4$\x00 A\x00\x00\x00\x00\x00\x03\x00\x00\x00\x01\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6767,7 +6767,7 @@ assert(p.data[0].tolerance == 32768000) = NTP Private (mode 7) - REQ_MON_GETLIST_1 (1) - request -s = '\x17\x00\x03*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\x17\x00\x03*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6780,7 +6780,7 @@ assert(p.data_item_size == 0) = NTP Private (mode 7) - REQ_MON_GETLIST_1 (2) - response -s = '\xd7\x00\x03*\x00\x06\x00H\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\x94mw\xe9\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\x13\xb6\xa9J\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xbb]\x81\xea\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xfc\xbf\xd5a\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xbe\x10x\xa8\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xde[ng\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s = b'\xd7\x00\x03*\x00\x06\x00H\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\x94mw\xe9\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\x13\xb6\xa9J\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xbb]\x81\xea\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xfc\xbf\xd5a\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xbe\x10x\xa8\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x00\x00;\x00\x00\x01\xd0\x00\x00\x00\x01\xde[ng\xc0\xa8zg\x00\x00\x00\x01\x00{\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6793,7 +6793,7 @@ assert(p.data_item_size == 72) = NTP Private (mode 7) - REQ_IF_STATS (1) - request -s = '\x17\x80\x03,\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xeb\xdd\x8cH\xefe\x00\x00\x00\x01\x8b\xfb\x90u\xa8ad\xe8\x87\xca\xbf\x96\xd2\x9d\xddI' +s = b'\x17\x80\x03,\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xeb\xdd\x8cH\xefe\x00\x00\x00\x01\x8b\xfb\x90u\xa8ad\xe8\x87\xca\xbf\x96\xd2\x9d\xddI' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6810,7 +6810,7 @@ assert(p.authenticator.dgst.encode("hex") == '8bfb9075a86164e887cabf96d29ddd49') = NTP Private (mode 7) - REQ_IF_STATS (2) - response -s = "\xd7\x00\x03,\x00\x03\x00\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x01lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\n\x00'\xff\xfe\xe3\x81r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\n\x00'\xff\xfe\xa0\x1d\xd0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x05\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00" +s = b"\xd7\x00\x03,\x00\x03\x00\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x01lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\n\x00'\xff\xfe\xe3\x81r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\n\x00'\xff\xfe\xa0\x1d\xd0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x05\x00\x00\x00\x00\x00\n\x00\x01\x00\x00\x00\x00" p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6829,7 +6829,7 @@ assert(p.data[0].ifname.startswith("lo")) = NTP Private (mode 7) - REQ_IF_STATS (3) - response -s = '\xd7\x01\x03,\x00\x03\x00\x88\xc0\xa8ze\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8z\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x02\x00\x01\x00\x00\x00\x00\n\x00\x02\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00' +s = b'\xd7\x01\x03,\x00\x03\x00\x88\xc0\xa8ze\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8z\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x02\x00\x01\x00\x00\x00\x00\n\x00\x02\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6848,7 +6848,7 @@ assert(p.data[0].ifname.startswith("eth1")) = NTP Private (mode 7) - REQ_IF_RELOAD (1) - request -s = '\x17\x80\x03-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xed\xa3\xdc\x7f\xc6\x11\x00\x00\x00\x01\xfb>\x96*\xe7O\xf7\x8feh\xd4\x07L\xc0\x08\xcb' +s = b'\x17\x80\x03-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdb9\xed\xa3\xdc\x7f\xc6\x11\x00\x00\x00\x01\xfb>\x96*\xe7O\xf7\x8feh\xd4\x07L\xc0\x08\xcb' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 0) @@ -6865,7 +6865,7 @@ assert(p.authenticator.dgst.encode("hex") == 'fb3e962ae74ff78f6568d4074cc008cb') = NTP Private (mode 7) - REQ_IF_RELOAD (2) - response -s = '\xd7\x00\x03-\x00\x03\x00\x88\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00\n\x00\x02\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x05\x00\x02\x00\x01\x00\x00\x00\x00\xc0\xa8ze\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8z\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00=\x00\x00\x00}\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\t\x00\x02\x00\x01\x00\x00\x00\x00' +s = b'\xd7\x00\x03-\x00\x03\x00\x88\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00lo\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00\n\x00\x02\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x02\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x05\x00\x02\x00\x01\x00\x00\x00\x00\xc0\xa8ze\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\xa8z\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00eth1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00=\x00\x00\x00}\x00\x00\x00\x00\x00\x00\x01\xf4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\t\x00\x02\x00\x01\x00\x00\x00\x00' p = NTP(s) assert(isinstance(p, NTPPrivate)) assert(p.response == 1) @@ -6888,10 +6888,10 @@ assert(p.data[0].ifname.startswith("lo")) + VXLAN layer = Build a VXLAN packet with VNI of 42 -str(UDP(sport=1024, dport=4789, len=None, chksum=None)/VXLAN(flags=0x08, vni=42)) == '\x04\x00\x12\xb5\x00\x10\x00\x00\x08\x00\x00\x00\x00\x00\x2a\x00' +str(UDP(sport=1024, dport=4789, len=None, chksum=None)/VXLAN(flags=0x08, vni=42)) == b'\x04\x00\x12\xb5\x00\x10\x00\x00\x08\x00\x00\x00\x00\x00\x2a\x00' = Verify VXLAN Ethernet Binding -str(VXLAN(vni=23)/Ether(dst="11:11:11:11:11:11", src="11:11:11:11:11:11", type=0x800)) == '\x0c\x00\x00\x03\x00\x00\x17\x00\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x08\x00' +str(VXLAN(vni=23)/Ether(dst="11:11:11:11:11:11", src="11:11:11:11:11:11", type=0x800)) == b'\x0c\x00\x00\x03\x00\x00\x17\x00\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x08\x00' = Verify UDP dport overloading p = Ether(dst="11:11:11:11:11:11", src="22:22:22:22:22:22") @@ -6940,7 +6940,7 @@ assert(p[Ether:2].type == 0x800) import socket class MockSocket(object): def __init__(self): - self.l = [ '\x00\x00\x00\x01', '\x00\x00\x00\x02', '\x00\x00\x00\x03' ] + self.l = [ b'\x00\x00\x00\x01', b'\x00\x00\x00\x02', b'\x00\x00\x00\x03' ] def recv(self, x): if len(self.l) == 0: raise socket.error(100, 'EOF') @@ -6977,7 +6977,7 @@ assert(ret) import socket class MockSocket(object): def __init__(self): - self.l = [ '\x00\x00\x00\x01\x00\x00\x00\x02', '\x00\x00\x00\x03\x00\x00\x00\x04' ] + self.l = [ b'\x00\x00\x00\x01\x00\x00\x00\x02', b'\x00\x00\x00\x03\x00\x00\x00\x04' ] def recv(self, x): if len(self.l) == 0: raise socket.error(100, 'EOF') @@ -7016,7 +7016,7 @@ assert(ret) import socket class MockSocket(object): def __init__(self): - self.l = [ '\x00\x00', '\x00\x01', '\x00\x00\x00', '\x02', '\x00\x00', '\x00', '\x03' ] + self.l = [ b'\x00\x00', b'\x00\x01', b'\x00\x00\x00', b'\x02', b'\x00\x00', b'\x00', b'\x03' ] def recv(self, x): if len(self.l) == 0: raise socket.error(100, 'EOF') @@ -7077,22 +7077,22 @@ assert(p.data == 3) from scapy.pton_ntop import _inet6_ntop, inet_ntop import socket for binfrm, address in [ - ('\x00' * 16, '::'), - ('\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88', + (b'\x00' * 16, '::'), + (b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88', '1111:2222:3333:4444:5555:6666:7777:8888'), - ('\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x00\x00\x00\x00\x00\x00', + (b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x00\x00\x00\x00\x00\x00', '1111:2222:3333:4444:5555::'), - ('\x00\x00\x00\x00\x00\x00\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88', + (b'\x00\x00\x00\x00\x00\x00\x44\x44\x55\x55\x66\x66\x77\x77\x88\x88', '::4444:5555:6666:7777:8888'), - ('\x00\x00\x00\x00\x33\x33\x44\x44\x00\x00\x00\x00\x00\x00\x88\x88', + (b'\x00\x00\x00\x00\x33\x33\x44\x44\x00\x00\x00\x00\x00\x00\x88\x88', '0:0:3333:4444::8888'), - ('\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + (b'\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', '1::'), - ('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', + (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', '::1'), - ('\x11\x11\x00\x00\x00\x00\x44\x44\x00\x00\x00\x00\x77\x77\x88\x88', + (b'\x11\x11\x00\x00\x00\x00\x44\x44\x00\x00\x00\x00\x77\x77\x88\x88', '1111::4444:0:0:7777:8888'), - ('\x10\x00\x02\x00\x00\x30\x00\x04\x00\x05\x00\x60\x07\x00\x80\x00', + (b'\x10\x00\x02\x00\x00\x30\x00\x04\x00\x05\x00\x60\x07\x00\x80\x00', '1000:200:30:4:5:60:700:8000'), ]: addr1 = inet_ntop(socket.AF_INET6, binfrm) @@ -7100,7 +7100,7 @@ for binfrm, address in [ assert address == addr1 == addr2 = IPv6 bin to string conversion - Zero-block of length 1 -binfrm = '\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x00\x00\x88\x88' +binfrm = b'\x11\x11\x22\x22\x33\x33\x44\x44\x55\x55\x66\x66\x00\x00\x88\x88' addr1, addr2 = inet_ntop(socket.AF_INET6, binfrm), _inet6_ntop(binfrm) # On Mac OS socket.inet_ntop is not fully compliant with RFC 5952 and # shortens the single zero block to '::'. This is a valid IPv6 address @@ -7110,7 +7110,7 @@ assert(addr1 in ['1111:2222:3333:4444:5555:6666:0:8888', assert(addr2 == '1111:2222:3333:4444:5555:6666:0:8888') = IPv6 bin to string conversion - Illegal sizes -for binfrm in ["\x00" * 15, "\x00" * 17]: +for binfrm in ["\x00" * 15, b"\x00" * 17]: rc = False try: inet_ntop(socket.AF_INET6, binfrm) @@ -7130,7 +7130,7 @@ for binfrm in ["\x00" * 15, "\x00" * 17]: = VRRP - build s = str(IP()/VRRP()) -s == 'E\x00\x00$\x00\x01\x00\x00@p|g\x7f\x00\x00\x01\x7f\x00\x00\x01!\x01d\x00\x00\x01z\xfd\x00\x00\x00\x00\x00\x00\x00\x00' +s == b'E\x00\x00$\x00\x01\x00\x00@p|g\x7f\x00\x00\x01\x7f\x00\x00\x01!\x01d\x00\x00\x01z\xfd\x00\x00\x00\x00\x00\x00\x00\x00' = VRRP - dissection p = IP(s) @@ -7143,7 +7143,7 @@ VRRP in p and p[VRRP].chksum == 0x7afd = L2TP - build s = str(IP()/UDP()/L2TP()) -s == 'E\x00\x00*\x00\x01\x00\x00@\x11|\xc0\x7f\x00\x00\x01\x7f\x00\x00\x01\x06\xa5\x06\xa5\x00\x16\xf4e\x00\x02\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s == b'E\x00\x00*\x00\x01\x00\x00@\x11|\xc0\x7f\x00\x00\x01\x7f\x00\x00\x01\x06\xa5\x06\xa5\x00\x16\xf4e\x00\x02\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = L2TP - dissection p = IP(s) @@ -7168,7 +7168,7 @@ assert pkt[HSRPmd5].type == 4 and pkt[HSRPmd5].sourceip == defaddr = RIP - build s = str(IP()/UDP(sport=520)/RIP()/RIPEntry()/RIPAuth(authtype=2, password="scapy")) -s == 'E\x00\x00H\x00\x01\x00\x00@\x11|\xa2\x7f\x00\x00\x01\x7f\x00\x00\x01\x02\x08\x02\x08\x004\xae\x99\x01\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xff\x00\x02scapy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s == b'E\x00\x00H\x00\x01\x00\x00@\x11|\xa2\x7f\x00\x00\x01\x7f\x00\x00\x01\x02\x08\x02\x08\x004\xae\x99\x01\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xff\x00\x02scapy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = RIP - dissection p = IP(s) @@ -7181,7 +7181,7 @@ RIPEntry in p and RIPAuth in p and p[RIPAuth].password.startswith("scapy") = Radius - build s = str(IP()/UDP(sport=1812)/Radius(authenticator="scapy")/RadiusAttribute(value="scapy")) -s == 'E\x00\x007\x00\x01\x00\x00@\x11|\xb3\x7f\x00\x00\x01\x7f\x00\x00\x01\x07\x14\x07\x15\x00#U\xb2\x01\x00\x00\x1bscapy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x07scapy' +s == b'E\x00\x007\x00\x01\x00\x00@\x11|\xb3\x7f\x00\x00\x01\x7f\x00\x00\x01\x07\x14\x07\x15\x00#U\xb2\x01\x00\x00\x1bscapy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x07scapy' = Radius - dissection p = IP(s) @@ -7240,7 +7240,7 @@ in6_iseui64("fe80::bae8:58ff:fed4:e5f6") == True in6_isanycast("2001:db8::fdff:ffff:ffff:ff80") == True a = inet_pton(socket.AF_INET6, "2001:db8::2807") -in6_xor(a, a) == "\x00" * 16 +in6_xor(a, a) == b"\x00" * 16 a = inet_pton(socket.AF_INET6, "fe80::bae8:58ff:fed4:e5f6") r = inet_ntop(socket.AF_INET6, in6_getnsma(a)) @@ -7274,8 +7274,8 @@ ip6_bad_addrs = ["fe80::2e67:ef2d:7eca::ed8a", "fe80:1234:abcd::192.168.40.12:abcd", "fe80:1234:abcd::192.168.40", "fe80:1234:abcd::192.168.400.12", - "1234:5678:9abc:def0:1234:5678:9abc:def0:", - "1234:5678:9abc:def0:1234:5678:9abc:def0:1234"] + "1234:5678:9abc:def0:1234:5678:9abc:def0:", + "1234:5678:9abc:def0:1234:5678:9abc:def0:1234"] for ip6 in ip6_bad_addrs: rc = False try: @@ -7291,16 +7291,16 @@ for ip6 in ip6_bad_addrs: assert rc ip6_good_addrs = [("fe80:1234:abcd::192.168.40.12", - '\xfe\x80\x124\xab\xcd\x00\x00\x00\x00\x00\x00\xc0\xa8(\x0c'), + b'\xfe\x80\x124\xab\xcd\x00\x00\x00\x00\x00\x00\xc0\xa8(\x0c'), ("fe80:1234:abcd::fe06", - '\xfe\x80\x124\xab\xcd\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x06'), + b'\xfe\x80\x124\xab\xcd\x00\x00\x00\x00\x00\x00\x00\x00\xfe\x06'), ("fe80::2e67:ef2d:7ece:ed8a", - '\xfe\x80\x00\x00\x00\x00\x00\x00.g\xef-~\xce\xed\x8a'), - ("::ffff", - '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff'), - ("ffff::", - '\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), - ('::', '\x00' * 16)] + b'\xfe\x80\x00\x00\x00\x00\x00\x00.g\xef-~\xce\xed\x8a'), + ("::ffff", + b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff'), + ("ffff::", + b'\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), + ('::', b'\x00' * 16)] for ip6, res in ip6_good_addrs: res1 = inet_pton(socket.AF_INET6, ip6) res2 = _inet6_pton(ip6) @@ -7563,7 +7563,7 @@ assert [p[TCP].flags for p in plist] == [2, 18, 16] = SCTP - Chunk Init - build s = str(IP()/SCTP()/SCTPChunkInit(params=[SCTPChunkParamIPv4Addr()])) -s == 'E\x00\x00<\x00\x01\x00\x00@\x84|;\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00@,\x0b_\x01\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x08\x7f\x00\x00\x01' +s == b'E\x00\x00<\x00\x01\x00\x00@\x84|;\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00@,\x0b_\x01\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x08\x7f\x00\x00\x01' = SCTP - Chunk Init - dissection p = IP(s) @@ -7571,7 +7571,7 @@ SCTPChunkParamIPv4Addr in p and p[SCTP].chksum == 0x402c0b5f and p[SCTPChunkPara = SCTP - SCTPChunkSACK - build s = str(IP()/SCTP()/SCTPChunkSACK(gap_ack_list=["7:28"])) -s == 'E\x00\x004\x00\x01\x00\x00@\x84|C\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00;\x01\xd4\x04\x03\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x07\x00\x1c' +s == b'E\x00\x004\x00\x01\x00\x00@\x84|C\x7f\x00\x00\x01\x7f\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00;\x01\xd4\x04\x03\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x07\x00\x1c' = SCTP - SCTPChunkSACK - dissection p = IP(s) @@ -7595,12 +7595,12 @@ str(RandDHCPOptions()) == "[('WWW_server', '90.219.239.175')]" value = ("hostname", "scapy") dof = DHCPOptionsField("options", value) dof.i2repr("", value) == '[hostname scapy]' -dof.i2m("", value) == '\x0cscapy' +dof.i2m("", value) == b'\x0cscapy' = DHCP - build s = str(IP()/UDP()/BOOTP(chaddr="00:01:02:03:04:05")/DHCP(options=[("message-type","discover"),"end"])) -s == 'E\x00\x01\x10\x00\x01\x00\x00@\x11{\xda\x7f\x00\x00\x01\x7f\x00\x00\x01\x00C\x00D\x00\xfcf\xea\x01\x01\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0000:01:02:03:04:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x01\xff' +s == b'E\x00\x01\x10\x00\x01\x00\x00@\x11{\xda\x7f\x00\x00\x01\x7f\x00\x00\x01\x00C\x00D\x00\xfcf\xea\x01\x01\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0000:01:02:03:04:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00c\x82Sc5\x01\x01\xff' = DHCP - dissection p = IP(s) @@ -7622,7 +7622,7 @@ len(dpl_ether) == 1 and Ether in dpl_ether[0] = Dot11 - build s = str(Dot11()) -s == '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s == b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = Dot11 - dissection p = Dot11(s) @@ -7631,7 +7631,7 @@ p.mysummary() == '802.11 Management 0L 00:00:00:00:00:00 > 00:00:00:00:00:00' = Dot11QoS - build s = str(Dot11(type=2, subtype=8)/Dot11QoS()) -s == '\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +s == b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' = Dot11QoS - dissection p = Dot11(s) @@ -7662,11 +7662,11 @@ len([k for k in conf.mib.iterkeys() if "scapy" in k]) == 1 = BER tests BER_id_enc(42) == '*' -BER_id_enc(2807) == '\xbfw' +BER_id_enc(2807) == b'\xbfw' b = BERcodec_IPADDRESS() r1 = b.enc("8.8.8.8") -r1 == '@\x04\x08\x08\x08\x08' +r1 == b'@\x04\x08\x08\x08\x08' r2 = b.dec(r1)[0] r2.val == '8.8.8.8' @@ -7681,7 +7681,7 @@ value == 26908070 test.i2repr("", value) == '7:28:28.70' = IPv4 - UDP null checksum -IP(str(IP()/UDP()/Raw("\xff\xff\x01\x6a")))[UDP].chksum == 0xFFFF +IP(str(IP()/UDP()/Raw(b"\xff\xff\x01\x6a")))[UDP].chksum == 0xFFFF = IPv4 - (IP|UDP|TCP|ICMP)Error query = IP(dst="192.168.0.1", src="192.168.0.254", ttl=1)/UDP()/DNS() diff --git a/test/tls.uts b/test/tls.uts index 0604b17ac03725d41b6d72041e4af6b6af5927c2..0b07cc1e9a9479ceaa01d1d82703f25c27af11f5 100644 --- a/test/tls.uts +++ b/test/tls.uts @@ -21,13 +21,13 @@ a.key_len == 16 and a.hmac_len == 16 = Crypto - Hmac_MD5 behavior on test vectors from RFC 2202 (+ errata) a = Hmac_MD5 -t1 = a('\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b').digest("Hi There") == '\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d' -t2 = a('Jefe').digest('what do ya want for nothing?') == '\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38' -t3 = a('\xaa'*16).digest('\xdd'*50) == '\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6' -t4 = a('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19').digest('\xcd'*50) == '\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79' -t5 = a('\x0c'*16).digest("Test With Truncation") == '\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c' -t6 = a('\xaa'*80).digest("Test Using Larger Than Block-Size Key - Hash Key First") == '\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd' -t7 = a('\xaa'*80).digest("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data") == '\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e' +t1 = a(b'\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b').digest("Hi There") == b'\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d' +t2 = a('Jefe').digest('what do ya want for nothing?') == b'\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38' +t3 = a(b'\xaa'*16).digest(b'\xdd'*50) == b'\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6' +t4 = a(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19').digest(b'\xcd'*50) == b'\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79' +t5 = a(b'\x0c'*16).digest("Test With Truncation") == b'\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c' +t6 = a(b'\xaa'*80).digest("Test Using Larger Than Block-Size Key - Hash Key First") == b'\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd' +t7 = a(b'\xaa'*80).digest("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data") == b'\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e' t1 and t2 and t3 and t4 and t5 and t6 and t7 @@ -39,13 +39,13 @@ a.key_len == 20 and a.hmac_len == 20 = Crypto - Hmac_SHA behavior on test vectors from RFC 2202 (+ errata) a = Hmac_SHA -t1 = a('\x0b'*20).digest("Hi There") == '\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00' -t2 = a('Jefe').digest("what do ya want for nothing?") == '\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79' -t3 = a('\xaa'*20).digest('\xdd'*50) == '\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3' -t4 = a('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19').digest('\xcd'*50) == '\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda' -t5 = a('\x0c'*20).digest("Test With Truncation") == '\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04' -t6 = a('\xaa'*80).digest("Test Using Larger Than Block-Size Key - Hash Key First") == '\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12' -t7 = a('\xaa'*80).digest("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data") == '\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91' +t1 = a(b'\x0b'*20).digest("Hi There") == b'\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1\x46\xbe\x00' +t2 = a('Jefe').digest("what do ya want for nothing?") == b'\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79' +t3 = a(b'\xaa'*20).digest(b'\xdd'*50) == b'\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3' +t4 = a(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19').digest(b'\xcd'*50) == b'\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda' +t5 = a(b'\x0c'*20).digest("Test With Truncation") == b'\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04' +t6 = a(b'\xaa'*80).digest("Test Using Larger Than Block-Size Key - Hash Key First") == b'\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12' +t7 = a(b'\xaa'*80).digest("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data") == b'\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91' t1 and t2 and t3 and t4 and t5 and t6 and t7 @@ -53,181 +53,181 @@ t1 and t2 and t3 and t4 and t5 and t6 and t7 = Crypto - Hmac_SHA2 behavior on test vectors from RFC 4231 class _hmac_test_case_1: - Key = ('\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b'+ - '\x0b\x0b\x0b\x0b\x0b\x0b\x0b') - Data = '\x48\x69\x20\x54\x68\x65\x72\x65' - HMAC_SHA_224 = ('\x89\x6f\xb1\x12\x8a\xbb\xdf\x19\x68\x32\x10\x7c\xd4'+ - '\x9d\xf3\x3f\x47\xb4\xb1\x16\x99\x12\xba\x4f\x53\x68'+ - '\x4b\x22') - HMAC_SHA_256 = ('\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf'+ - '\x0b\xf1\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9'+ - '\x37\x6c\x2e\x32\xcf\xf7') - HMAC_SHA_384 = ('\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab'+ - '\x46\x90\x7f\x15\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa'+ - '\x03\x4c\x7c\xeb\xc5\x9c\xfa\xea\x9e\xa9\x07\x6e\xde'+ - '\x7f\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6') - HMAC_SHA_512 = ('\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a'+ - '\x1d\x6c\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0'+ - '\xb3\x05\x45\xe1\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7'+ - '\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4\xbe\x9d\x91\x4e'+ - '\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54') + Key = (b'\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b'+ + b'\x0b\x0b\x0b\x0b\x0b\x0b\x0b') + Data = b'\x48\x69\x20\x54\x68\x65\x72\x65' + HMAC_SHA_224 = (b'\x89\x6f\xb1\x12\x8a\xbb\xdf\x19\x68\x32\x10\x7c\xd4'+ + b'\x9d\xf3\x3f\x47\xb4\xb1\x16\x99\x12\xba\x4f\x53\x68'+ + b'\x4b\x22') + HMAC_SHA_256 = (b'\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf'+ + b'\x0b\xf1\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9'+ + b'\x37\x6c\x2e\x32\xcf\xf7') + HMAC_SHA_384 = (b'\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab'+ + b'\x46\x90\x7f\x15\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa'+ + b'\x03\x4c\x7c\xeb\xc5\x9c\xfa\xea\x9e\xa9\x07\x6e\xde'+ + b'\x7f\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6') + HMAC_SHA_512 = (b'\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a'+ + b'\x1d\x6c\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0'+ + b'\xb3\x05\x45\xe1\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7'+ + b'\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4\xbe\x9d\x91\x4e'+ + b'\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54') class _hmac_test_case_2: - Key = '\x4a\x65\x66\x65' - Data = ('\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61\x20\x77\x61'+ - '\x6e\x74\x20\x66\x6f\x72\x20\x6e\x6f\x74\x68\x69\x6e'+ - '\x67\x3f') - HMAC_SHA_224 = ('\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf\x45\x69\x0f\x3a\x7e'+ - '\x9e\x6d\x0f\x8b\xbe\xa2\xa3\x9e\x61\x48\x00\x8f\xd0'+ - '\x5e\x44') - HMAC_SHA_256 = ('\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08'+ - '\x95\x75\xc7\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec'+ - '\x58\xb9\x64\xec\x38\x43') - HMAC_SHA_384 = ('\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5'+ - '\x8a\x6b\x1b\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47\xe4\x2e'+ - '\xc3\x73\x63\x22\x44\x5e\x8e\x22\x40\xca\x5e\x69\xe2'+ - '\xc7\x8b\x32\x39\xec\xfa\xb2\x16\x49') - HMAC_SHA_512 = ('\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b'+ - '\x56\xe0\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27'+ - '\x0c\xd7\xea\x25\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99'+ - '\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd\xca\xea\xb1\xa3'+ - '\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37') + Key = b'\x4a\x65\x66\x65' + Data = (b'\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61\x20\x77\x61'+ + b'\x6e\x74\x20\x66\x6f\x72\x20\x6e\x6f\x74\x68\x69\x6e'+ + b'\x67\x3f') + HMAC_SHA_224 = (b'\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf\x45\x69\x0f\x3a\x7e'+ + b'\x9e\x6d\x0f\x8b\xbe\xa2\xa3\x9e\x61\x48\x00\x8f\xd0'+ + b'\x5e\x44') + HMAC_SHA_256 = (b'\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08'+ + b'\x95\x75\xc7\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec'+ + b'\x58\xb9\x64\xec\x38\x43') + HMAC_SHA_384 = (b'\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5'+ + b'\x8a\x6b\x1b\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47\xe4\x2e'+ + b'\xc3\x73\x63\x22\x44\x5e\x8e\x22\x40\xca\x5e\x69\xe2'+ + b'\xc7\x8b\x32\x39\xec\xfa\xb2\x16\x49') + HMAC_SHA_512 = (b'\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b'+ + b'\x56\xe0\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27'+ + b'\x0c\xd7\xea\x25\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99'+ + b'\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd\xca\xea\xb1\xa3'+ + b'\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37') class _hmac_test_case_3: - Key = ('\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa') - Data = ('\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ - '\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ - '\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ - '\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd') - HMAC_SHA_224 = ('\x7f\xb3\xcb\x35\x88\xc6\xc1\xf6\xff\xa9\x69\x4d\x7d'+ - '\x6a\xd2\x64\x93\x65\xb0\xc1\xf6\x5d\x69\xd1\xec\x83'+ - '\x33\xea') - HMAC_SHA_256 = ('\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0'+ - '\x91\x81\xa7\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63'+ - '\x55\x14\xce\xd5\x65\xfe') - HMAC_SHA_384 = ('\x88\x06\x26\x08\xd3\xe6\xad\x8a\x0a\xa2\xac\xe0\x14'+ - '\xc8\xa8\x6f\x0a\xa6\x35\xd9\x47\xac\x9f\xeb\xe8\x3e'+ - '\xf4\xe5\x59\x66\x14\x4b\x2a\x5a\xb3\x9d\xc1\x38\x14'+ - '\xb9\x4e\x3a\xb6\xe1\x01\xa3\x4f\x27') - HMAC_SHA_512 = ('\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c'+ - '\x89\x0b\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8'+ - '\x3e\x33\xb2\x27\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22'+ - '\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07\xb9\x46\xa3\x37'+ - '\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb') + Key = (b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa') + Data = (b'\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ + b'\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ + b'\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd'+ + b'\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd') + HMAC_SHA_224 = (b'\x7f\xb3\xcb\x35\x88\xc6\xc1\xf6\xff\xa9\x69\x4d\x7d'+ + b'\x6a\xd2\x64\x93\x65\xb0\xc1\xf6\x5d\x69\xd1\xec\x83'+ + b'\x33\xea') + HMAC_SHA_256 = (b'\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0'+ + b'\x91\x81\xa7\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63'+ + b'\x55\x14\xce\xd5\x65\xfe') + HMAC_SHA_384 = (b'\x88\x06\x26\x08\xd3\xe6\xad\x8a\x0a\xa2\xac\xe0\x14'+ + b'\xc8\xa8\x6f\x0a\xa6\x35\xd9\x47\xac\x9f\xeb\xe8\x3e'+ + b'\xf4\xe5\x59\x66\x14\x4b\x2a\x5a\xb3\x9d\xc1\x38\x14'+ + b'\xb9\x4e\x3a\xb6\xe1\x01\xa3\x4f\x27') + HMAC_SHA_512 = (b'\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c'+ + b'\x89\x0b\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8'+ + b'\x3e\x33\xb2\x27\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22'+ + b'\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07\xb9\x46\xa3\x37'+ + b'\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb') class _hmac_test_case_4: - Key = ('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d'+ - '\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19') - Data = ('\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ - '\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ - '\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ - '\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd') - HMAC_SHA_224 = ('\x6c\x11\x50\x68\x74\x01\x3c\xac\x6a\x2a\xbc\x1b\xb3'+ - '\x82\x62\x7c\xec\x6a\x90\xd8\x6e\xfc\x01\x2d\xe7\xaf'+ - '\xec\x5a') - HMAC_SHA_256 = ('\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99'+ - '\xf2\x08\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e'+ - '\x3f\xf4\x67\x29\x66\x5b') - HMAC_SHA_384 = ('\x3e\x8a\x69\xb7\x78\x3c\x25\x85\x19\x33\xab\x62\x90'+ - '\xaf\x6c\xa7\x7a\x99\x81\x48\x08\x50\x00\x9c\xc5\x57'+ - '\x7c\x6e\x1f\x57\x3b\x4e\x68\x01\xdd\x23\xc4\xa7\xd6'+ - '\x79\xcc\xf8\xa3\x86\xc6\x74\xcf\xfb') - HMAC_SHA_512 = ('\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6'+ - '\x1d\x4a\xf7\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f'+ - '\x80\x50\x36\x1e\xe3\xdb\xa9\x1c\xa5\xc1\x1a\xa2\x5e'+ - '\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63\xa5\xf1\x97\x41'+ - '\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd') + Key = (b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d'+ + b'\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19') + Data = (b'\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ + b'\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ + b'\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd'+ + b'\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd') + HMAC_SHA_224 = (b'\x6c\x11\x50\x68\x74\x01\x3c\xac\x6a\x2a\xbc\x1b\xb3'+ + b'\x82\x62\x7c\xec\x6a\x90\xd8\x6e\xfc\x01\x2d\xe7\xaf'+ + b'\xec\x5a') + HMAC_SHA_256 = (b'\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99'+ + b'\xf2\x08\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e'+ + b'\x3f\xf4\x67\x29\x66\x5b') + HMAC_SHA_384 = (b'\x3e\x8a\x69\xb7\x78\x3c\x25\x85\x19\x33\xab\x62\x90'+ + b'\xaf\x6c\xa7\x7a\x99\x81\x48\x08\x50\x00\x9c\xc5\x57'+ + b'\x7c\x6e\x1f\x57\x3b\x4e\x68\x01\xdd\x23\xc4\xa7\xd6'+ + b'\x79\xcc\xf8\xa3\x86\xc6\x74\xcf\xfb') + HMAC_SHA_512 = (b'\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6'+ + b'\x1d\x4a\xf7\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f'+ + b'\x80\x50\x36\x1e\xe3\xdb\xa9\x1c\xa5\xc1\x1a\xa2\x5e'+ + b'\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63\xa5\xf1\x97\x41'+ + b'\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd') class _hmac_test_case_5: - Key = ('\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'+ - '\x0c\x0c\x0c\x0c\x0c\x0c\x0c') - Data = ('\x54\x65\x73\x74\x20\x57\x69\x74\x68\x20\x54\x72\x75'+ - '\x6e\x63\x61\x74\x69\x6f\x6e') - HMAC_SHA_224 = ('\x0e*\xeah\xa9\x0c\x8d7\xc9\x88\xbc\xdb\x9f\xcao\xa8'+ - '\t\x9c\xd8W\xc7\xecJ\x18\x15\xca\xc5L') - HMAC_SHA_256 = ('\xa3\xb6\x16ts\x10\x0e\xe0n\x0cyl)UU+\xfao|\nj\x8a'+ - '\xef\x8b\x93\xf8`\xaa\xb0\xcd \xc5') - HMAC_SHA_384 = (':\xbf4\xc3P;*#\xa4n\xfca\x9b\xae\xf8\x97\xf4\xc8\xe4'+ - ',\x93L\xe5\\\xcb\xae\x97@\xfc\xbc\x1a\xf4\xcab&\x9e*'+ - '7\xcd\x88\xba\x92cA\xef\xe4\xae\xea') - HMAC_SHA_512 = ('A_\xadbqX\nS\x1dAy\xbc\x89\x1d\x87\xa6P\x18\x87\x07'+ - '\x92*O\xbb6f:\x1e\xb1m\xa0\x08q\x1c[P\xdd\xd0\xfc#P'+ - '\x84\xeb\x9d3d\xa1EO\xb2\xefg\xcd\x1d)\xfegs\x06\x8e'+ - '\xa2f\xe9k') + Key = (b'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c'+ + b'\x0c\x0c\x0c\x0c\x0c\x0c\x0c') + Data = (b'\x54\x65\x73\x74\x20\x57\x69\x74\x68\x20\x54\x72\x75'+ + b'\x6e\x63\x61\x74\x69\x6f\x6e') + HMAC_SHA_224 = (b'\x0e*\xeah\xa9\x0c\x8d7\xc9\x88\xbc\xdb\x9f\xcao\xa8'+ + b'\t\x9c\xd8W\xc7\xecJ\x18\x15\xca\xc5L') + HMAC_SHA_256 = (b'\xa3\xb6\x16ts\x10\x0e\xe0n\x0cyl)UU+\xfao|\nj\x8a'+ + b'\xef\x8b\x93\xf8`\xaa\xb0\xcd \xc5') + HMAC_SHA_384 = (b':\xbf4\xc3P;*#\xa4n\xfca\x9b\xae\xf8\x97\xf4\xc8\xe4'+ + b',\x93L\xe5\\\xcb\xae\x97@\xfc\xbc\x1a\xf4\xcab&\x9e*'+ + b'7\xcd\x88\xba\x92cA\xef\xe4\xae\xea') + HMAC_SHA_512 = (b'A_\xadbqX\nS\x1dAy\xbc\x89\x1d\x87\xa6P\x18\x87\x07'+ + b'\x92*O\xbb6f:\x1e\xb1m\xa0\x08q\x1c[P\xdd\xd0\xfc#P'+ + b'\x84\xeb\x9d3d\xa1EO\xb2\xefg\xcd\x1d)\xfegs\x06\x8e'+ + b'\xa2f\xe9k') class _hmac_test_case_6: - Key = ('\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa') - Data = ('\x54\x65\x73\x74\x20\x55\x73\x69\x6e\x67\x20\x4c\x61'+ - '\x72\x67\x65\x72\x20\x54\x68\x61\x6e\x20\x42\x6c\x6f'+ - '\x63\x6b\x2d\x53\x69\x7a\x65\x20\x4b\x65\x79\x20\x2d'+ - '\x20\x48\x61\x73\x68\x20\x4b\x65\x79\x20\x46\x69\x72'+ - '\x73\x74') - HMAC_SHA_224 = ('\x95\xe9\xa0\xdb\x96\x20\x95\xad\xae\xbe\x9b\x2d\x6f'+ - '\x0d\xbc\xe2\xd4\x99\xf1\x12\xf2\xd2\xb7\x27\x3f\xa6'+ - '\x87\x0e') - HMAC_SHA_256 = ('\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb'+ - '\xf5\xb7\x7f\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46'+ - '\x04\x0f\x0e\xe3\x7f\x54') - HMAC_SHA_384 = ('\x4e\xce\x08\x44\x85\x81\x3e\x90\x88\xd2\xc6\x3a\x04'+ - '\x1b\xc5\xb4\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f\x3c\xd1'+ - '\x1f\x05\x03\x3a\xc4\xc6\x0c\x2e\xf6\xab\x40\x30\xfe'+ - '\x82\x96\x24\x8d\xf1\x63\xf4\x49\x52') - HMAC_SHA_512 = ('\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd'+ - '\x7b\xe8\xb4\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b'+ - '\x01\x37\x83\xf8\xf3\x52\x6b\x56\xd0\x37\xe0\x5f\x25'+ - '\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52\x95\xe6\x4f\x73'+ - '\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98') + Key = (b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa') + Data = (b'\x54\x65\x73\x74\x20\x55\x73\x69\x6e\x67\x20\x4c\x61'+ + b'\x72\x67\x65\x72\x20\x54\x68\x61\x6e\x20\x42\x6c\x6f'+ + b'\x63\x6b\x2d\x53\x69\x7a\x65\x20\x4b\x65\x79\x20\x2d'+ + b'\x20\x48\x61\x73\x68\x20\x4b\x65\x79\x20\x46\x69\x72'+ + b'\x73\x74') + HMAC_SHA_224 = (b'\x95\xe9\xa0\xdb\x96\x20\x95\xad\xae\xbe\x9b\x2d\x6f'+ + b'\x0d\xbc\xe2\xd4\x99\xf1\x12\xf2\xd2\xb7\x27\x3f\xa6'+ + b'\x87\x0e') + HMAC_SHA_256 = (b'\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb'+ + b'\xf5\xb7\x7f\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46'+ + b'\x04\x0f\x0e\xe3\x7f\x54') + HMAC_SHA_384 = (b'\x4e\xce\x08\x44\x85\x81\x3e\x90\x88\xd2\xc6\x3a\x04'+ + b'\x1b\xc5\xb4\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f\x3c\xd1'+ + b'\x1f\x05\x03\x3a\xc4\xc6\x0c\x2e\xf6\xab\x40\x30\xfe'+ + b'\x82\x96\x24\x8d\xf1\x63\xf4\x49\x52') + HMAC_SHA_512 = (b'\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd'+ + b'\x7b\xe8\xb4\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b'+ + b'\x01\x37\x83\xf8\xf3\x52\x6b\x56\xd0\x37\xe0\x5f\x25'+ + b'\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52\x95\xe6\x4f\x73'+ + b'\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98') class _hmac_test_case_7: - Key = ('\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ - '\xaa') - Data = ('\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73'+ - '\x74\x20\x75\x73\x69\x6e\x67\x20\x61\x20\x6c\x61\x72'+ - '\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63'+ - '\x6b\x2d\x73\x69\x7a\x65\x20\x6b\x65\x79\x20\x61\x6e'+ - '\x64\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68'+ - '\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65'+ - '\x20\x64\x61\x74\x61\x2e\x20\x54\x68\x65\x20\x6b\x65'+ - '\x79\x20\x6e\x65\x65\x64\x73\x20\x74\x6f\x20\x62\x65'+ - '\x20\x68\x61\x73\x68\x65\x64\x20\x62\x65\x66\x6f\x72'+ - '\x65\x20\x62\x65\x69\x6e\x67\x20\x75\x73\x65\x64\x20'+ - '\x62\x79\x20\x74\x68\x65\x20\x48\x4d\x41\x43\x20\x61'+ - '\x6c\x67\x6f\x72\x69\x74\x68\x6d\x2e') - HMAC_SHA_224 = ('\x3a\x85\x41\x66\xac\x5d\x9f\x02\x3f\x54\xd5\x17\xd0'+ - '\xb3\x9d\xbd\x94\x67\x70\xdb\x9c\x2b\x95\xc9\xf6\xf5'+ - '\x65\xd1') - HMAC_SHA_256 = ('\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5'+ - '\xb0\xe9\x44\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f'+ - '\x51\x53\x5c\x3a\x35\xe2') - HMAC_SHA_384 = ('\x66\x17\x17\x8e\x94\x1f\x02\x0d\x35\x1e\x2f\x25\x4e'+ - '\x8f\xd3\x2c\x60\x24\x20\xfe\xb0\xb8\xfb\x9a\xdc\xce'+ - '\xbb\x82\x46\x1e\x99\xc5\xa6\x78\xcc\x31\xe7\x99\x17'+ - '\x6d\x38\x60\xe6\x11\x0c\x46\x52\x3e') - HMAC_SHA_512 = ('\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e'+ - '\x5e\x3f\xfd\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5'+ - '\xa3\x2d\x20\xcd\xc9\x44\xb6\x02\x2c\xac\x3c\x49\x82'+ - '\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15\x13\x46\x76\xfb'+ - '\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58') + Key = (b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa'+ + b'\xaa') + Data = (b'\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73'+ + b'\x74\x20\x75\x73\x69\x6e\x67\x20\x61\x20\x6c\x61\x72'+ + b'\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63'+ + b'\x6b\x2d\x73\x69\x7a\x65\x20\x6b\x65\x79\x20\x61\x6e'+ + b'\x64\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68'+ + b'\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65'+ + b'\x20\x64\x61\x74\x61\x2e\x20\x54\x68\x65\x20\x6b\x65'+ + b'\x79\x20\x6e\x65\x65\x64\x73\x20\x74\x6f\x20\x62\x65'+ + b'\x20\x68\x61\x73\x68\x65\x64\x20\x62\x65\x66\x6f\x72'+ + b'\x65\x20\x62\x65\x69\x6e\x67\x20\x75\x73\x65\x64\x20'+ + b'\x62\x79\x20\x74\x68\x65\x20\x48\x4d\x41\x43\x20\x61'+ + b'\x6c\x67\x6f\x72\x69\x74\x68\x6d\x2e') + HMAC_SHA_224 = (b'\x3a\x85\x41\x66\xac\x5d\x9f\x02\x3f\x54\xd5\x17\xd0'+ + b'\xb3\x9d\xbd\x94\x67\x70\xdb\x9c\x2b\x95\xc9\xf6\xf5'+ + b'\x65\xd1') + HMAC_SHA_256 = (b'\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5'+ + b'\xb0\xe9\x44\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f'+ + b'\x51\x53\x5c\x3a\x35\xe2') + HMAC_SHA_384 = (b'\x66\x17\x17\x8e\x94\x1f\x02\x0d\x35\x1e\x2f\x25\x4e'+ + b'\x8f\xd3\x2c\x60\x24\x20\xfe\xb0\xb8\xfb\x9a\xdc\xce'+ + b'\xbb\x82\x46\x1e\x99\xc5\xa6\x78\xcc\x31\xe7\x99\x17'+ + b'\x6d\x38\x60\xe6\x11\x0c\x46\x52\x3e') + HMAC_SHA_512 = (b'\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e'+ + b'\x5e\x3f\xfd\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5'+ + b'\xa3\x2d\x20\xcd\xc9\x44\xb6\x02\x2c\xac\x3c\x49\x82'+ + b'\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15\x13\x46\x76\xfb'+ + b'\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58') def _all_hmac_sha2_tests(): from scapy.layers.tls.crypto.h_mac import (Hmac_SHA224, Hmac_SHA256, @@ -253,52 +253,52 @@ _all_hmac_sha2_tests() + Test _tls_P_MD5 = Crypto - _tls_P_MD5 behavior on test vectors borrowed from RFC 2202 (+ errata) from scapy.layers.tls.crypto.prf import _tls_P_MD5 -t1 = _tls_P_MD5('\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b', "Hi There", 64) == '8\x99\xc0\xb8!\xd7}RI\xb2\xbb\x8e\xbe\xf8\x97Y\xcc\xffL\xae\xc3I\x8f\x7f .\x81\xe0\xce\x1a\x82\xbd\x19\xa0\x16\x10P}\xf0\xda\xdc\xa0>\xc4,\xa1\xcfS`\x85\xc5\x084+QN31b\xd7%L\x9d\xdc' -t2 = _tls_P_MD5("Jefe", "what do ya want for nothing?", 64) == "\xec\x99'|,\xd5gj\x82\xb9\xa0\x12\xdb\x83\xd3\xa3\x93\x19\xa6N\x89g\x99\xc2!9\xd8\xcf\xc1WTi\xc4D \x19l\x03\xa8PCo\x10`-\x98\xd0\xe1\xbc\xefAJkx\x95\x0c\x08*\xd6C\x8fS\x0e\xd9" -t3 = _tls_P_MD5('\xaa'*16,'\xdd'*50, 64) == '\xe5_\xe8.l\xee\xd8AP\xfc$$\xda\tX\x93O\xa7\xd2\xe2\xa2\xa9\x02\xa1\x07t\x19\xd1\xe3%\x80\x19\rV\x19\x0f\xfa\x01\xce\x0eJ\x7fN\xdf\xed\xb5lS\x06\xb5|\x96\xa6\x1cc)h\x88\x8d\x0c@\xfdX\xaa' -t4 = _tls_P_MD5('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', '\xcd'*50, 64) == '\x8e\xa6\x1f\x82\x1e\xad\xbe4q\x93\xf4\x1c\xb7\x87\xb3\x15\x13F\x8b\xfd\x89m\x0e\xa6\xdc\xe9\xceZ\xcdOc>gN\xa4\x9cK\xf89\xfc6\t%T=j\xf0\x0f\xfdl\xbf\xfbj\xc4$zR"\xf4\xa4=\x18\x8b\x8d' -t5 = _tls_P_MD5('\x0c'*16, "Test With Truncation", 64) == '\xb3>\xfaj\xc8\x95S\xcd\xdd\xea\x8b\xee7\xa5ru\xf4\x00\xd6\xed\xd5\x9aH\x1f,F\xb6\x93\r\xc3Z<"\x1e\xf7rx\xf0\xd7\x0f`zy\xe9\r\xb4\xf4}\xab2\xa5\xfe\xd0z@\x87\xc1c\x8b\xa0\xc8\xf5\x0bd' -t6 = _tls_P_MD5('\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 64) == ';\xcf\xa4\xd8\xccH\xa0\xa4\xf1\x10d\xfa\xd4\xb1\x7f\xda\x80\xf6\xe2\xb9\xf4\xd3WtS\x1c\x83\xb4(\x94\xfe\xa7\xb9\xc1\xcd\xf9\xe7\xae\xbc\x0c\x0f\xbae\xc3\x9e\x11\xe2+\x11\xe9\xd4\x8fK&\x99\xfe[\xfa\x02\x85\xb4\xd8\x8e\xdf' -t7 = _tls_P_MD5('\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 64) == '\x12\x06EI1\x81fP\x8dn\xa6WC\xfb\xbf\x1e\xefC[|\x0f\x05w\x14@\xfc\xa5 \xeak\xc9\xb9\x1c&\x80\x81.\x85#\xa9\x0ff\xea\xaa\x01"v\'\xd8X"\xbd\xa2\x86\xbd\xe3?6\xc7|\xc6WNO' +t1 = _tls_P_MD5(b'\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b', "Hi There", 64) == b'8\x99\xc0\xb8!\xd7}RI\xb2\xbb\x8e\xbe\xf8\x97Y\xcc\xffL\xae\xc3I\x8f\x7f .\x81\xe0\xce\x1a\x82\xbd\x19\xa0\x16\x10P}\xf0\xda\xdc\xa0>\xc4,\xa1\xcfS`\x85\xc5\x084+QN31b\xd7%L\x9d\xdc' +t2 = _tls_P_MD5("Jefe", "what do ya want for nothing?", 64) == b"\xec\x99'|,\xd5gj\x82\xb9\xa0\x12\xdb\x83\xd3\xa3\x93\x19\xa6N\x89g\x99\xc2!9\xd8\xcf\xc1WTi\xc4D \x19l\x03\xa8PCo\x10`-\x98\xd0\xe1\xbc\xefAJkx\x95\x0c\x08*\xd6C\x8fS\x0e\xd9" +t3 = _tls_P_MD5(b'\xaa'*16,b'\xdd'*50, 64) == b'\xe5_\xe8.l\xee\xd8AP\xfc$$\xda\tX\x93O\xa7\xd2\xe2\xa2\xa9\x02\xa1\x07t\x19\xd1\xe3%\x80\x19\rV\x19\x0f\xfa\x01\xce\x0eJ\x7fN\xdf\xed\xb5lS\x06\xb5|\x96\xa6\x1cc)h\x88\x8d\x0c@\xfdX\xaa' +t4 = _tls_P_MD5(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', b'\xcd'*50, 64) == b'\x8e\xa6\x1f\x82\x1e\xad\xbe4q\x93\xf4\x1c\xb7\x87\xb3\x15\x13F\x8b\xfd\x89m\x0e\xa6\xdc\xe9\xceZ\xcdOc>gN\xa4\x9cK\xf89\xfc6\t%T=j\xf0\x0f\xfdl\xbf\xfbj\xc4$zR"\xf4\xa4=\x18\x8b\x8d' +t5 = _tls_P_MD5(b'\x0c'*16, "Test With Truncation", 64) == b'\xb3>\xfaj\xc8\x95S\xcd\xdd\xea\x8b\xee7\xa5ru\xf4\x00\xd6\xed\xd5\x9aH\x1f,F\xb6\x93\r\xc3Z<"\x1e\xf7rx\xf0\xd7\x0f`zy\xe9\r\xb4\xf4}\xab2\xa5\xfe\xd0z@\x87\xc1c\x8b\xa0\xc8\xf5\x0bd' +t6 = _tls_P_MD5(b'\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 64) == b';\xcf\xa4\xd8\xccH\xa0\xa4\xf1\x10d\xfa\xd4\xb1\x7f\xda\x80\xf6\xe2\xb9\xf4\xd3WtS\x1c\x83\xb4(\x94\xfe\xa7\xb9\xc1\xcd\xf9\xe7\xae\xbc\x0c\x0f\xbae\xc3\x9e\x11\xe2+\x11\xe9\xd4\x8fK&\x99\xfe[\xfa\x02\x85\xb4\xd8\x8e\xdf' +t7 = _tls_P_MD5(b'\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 64) == b'\x12\x06EI1\x81fP\x8dn\xa6WC\xfb\xbf\x1e\xefC[|\x0f\x05w\x14@\xfc\xa5 \xeak\xc9\xb9\x1c&\x80\x81.\x85#\xa9\x0ff\xea\xaa\x01"v\'\xd8X"\xbd\xa2\x86\xbd\xe3?6\xc7|\xc6WNO' t1 and t2 and t3 and t4 and t5 and t6 and t7 + Test _tls_P_SHA1 = Crypto - _tls_P_SHA1 behavior on test vectors borrowed from RFC 2202 (+ errata) from scapy.layers.tls.crypto.prf import _tls_P_SHA1 -t1 = _tls_P_SHA1('\x0b'*20, "Hi There", 80) == '\x13\r\x11Q7(\xc1\xad\x7f>%m\xfc\x08\xb6\xb9$\xb1MG\xe4\x9c\xcdY\x0e\\T\xd0\x8f\x1a-O@`\xd2\x9eV_\xfd\xed\x1f\x93V\xfb\x18\xb6\xbclq3A\xa2\x87\xb1u\xfc\xb3RQ\x19;#\n(\xd2o%lB\x8b\x01\x89\x1c6m"\xc3\xe2\xa0\xe7' -t2 = _tls_P_SHA1('Jefe', "what do ya want for nothing?", 80) == '\xba\xc4i\xf1\xa0\xc5eO\x844\xb6\xbd%L\xe1\xfe\xef\x08\x00\x1c^l\xaf\xbbN\x9f\xd8\xe5}\x87U\xc1\xd2&4zu\x9a1\xef\xd6M+\x1e\x84\xb4\xcb\xc9\xa7\n\x90f\x8aJ\xde\xd5\xa4\x8f,D\xe8.\x98\x9c)\xc7hlct\x1em(\xb73b[L\x96c' -t3 = _tls_P_SHA1('\xaa'*20, '\xdd'*50, 80) == 'Lm\x848}\xe8?\x88\x82\x85\xc3\xe6\xc9\x1f\x80Z\xf5D\xeeI\xa1m\x08h)\xea<zk{\x9b\x9b\xe1;H\xa4\xf5\x93r\x87\x07J0\n\xb9\xdd\\~j\xd0\x98R|C\x89\x131\x12u%\x90\xb2\x05\xb4}\xad}\xc4MP\x8cmb\x0c\x88\xfd{)\x9b\xc0' -t4 = _tls_P_SHA1('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', '\xcd'*50, 80) == '\xd6\xe4\x8a\x91\xb3\xac\xe16\x9d\x10s\xf1\x1bu\x96(6f\xed\xd8x\x19\xcd<:\x15\xb2z\xc1\xa9\xdf\x89=\xeb!\xfb\n\x0e\xdf0\xb9\xb5\xa96\xcf\x9b\xd4\xcaD\x12Y1[p\xb9\xf9\xbb=\xa9\xcd\xb7\xe0L\xb00\xafK\xc4\x9c\xc6?#\xb6$\xebM\x1a\xba;3' -t5 = _tls_P_SHA1('\x0c'*20, "Test With Truncation", 80) == '`\x1d\xe4\x98Q\xa1\xdbW\xc5a\xa9@\x8fQ\x86\xfc\x17\xca\xda\x1a\xdd\xb8\xab\x94M_Y\xd1%Pj\xfc\xd4\xca\x82\x88\xdb\x04\xf9F\xbe\xbf\xecR\xa4\x0c}[\x8e\xc7\xdf\x88I:\xea2v\xbe\x06\x8fcx\xf1Q\xb7z1\x1455?\xc0_\xda\xbb;\xa6Q\xb3\xc5' -t6 = _tls_P_SHA1('\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 80) == '\x00W\xbaq>^\x047;\xcezY}\x16\xc6\xf10\x80:\xe2K\x87i{\xc7V\xad2\xda=\xf3d7\x047\xf7r\xf1&\x04\xb1\xd1\xf8\x88H\'\r\x08\xc4\x81\xa3\xa1Q\xa5\x90\xed\xef\xd8\x9c\x14\xdc\x80\xab){3\xde\x87\x8a\x1e"\x1e\xad54rM\x94\xe1\xb8' -t7 = _tls_P_SHA1('\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == 'N/PKC\x1d\xb5[}gUk\xc7\xaf\xb4-\xef\x9e\xe63$E=\xfc\xc4\xd0l]EA\x84\xb0\x1e\x91]\xcc[\x0e-\xec\xd5\x90\x19,\xc6\xffn\xf8\xbe1Ck\xe6\x9cF*\x8c"_\x05\x14%h\x98\xa1\xc2\xf1bCt\xd4S\xc1:{\x96\xa4\x14c ' +t1 = _tls_P_SHA1(b'\x0b'*20, "Hi There", 80) == b'\x13\r\x11Q7(\xc1\xad\x7f>%m\xfc\x08\xb6\xb9$\xb1MG\xe4\x9c\xcdY\x0e\\T\xd0\x8f\x1a-O@`\xd2\x9eV_\xfd\xed\x1f\x93V\xfb\x18\xb6\xbclq3A\xa2\x87\xb1u\xfc\xb3RQ\x19;#\n(\xd2o%lB\x8b\x01\x89\x1c6m"\xc3\xe2\xa0\xe7' +t2 = _tls_P_SHA1('Jefe', "what do ya want for nothing?", 80) == b'\xba\xc4i\xf1\xa0\xc5eO\x844\xb6\xbd%L\xe1\xfe\xef\x08\x00\x1c^l\xaf\xbbN\x9f\xd8\xe5}\x87U\xc1\xd2&4zu\x9a1\xef\xd6M+\x1e\x84\xb4\xcb\xc9\xa7\n\x90f\x8aJ\xde\xd5\xa4\x8f,D\xe8.\x98\x9c)\xc7hlct\x1em(\xb73b[L\x96c' +t3 = _tls_P_SHA1(b'\xaa'*20, b'\xdd'*50, 80) == b'Lm\x848}\xe8?\x88\x82\x85\xc3\xe6\xc9\x1f\x80Z\xf5D\xeeI\xa1m\x08h)\xea<zk{\x9b\x9b\xe1;H\xa4\xf5\x93r\x87\x07J0\n\xb9\xdd\\~j\xd0\x98R|C\x89\x131\x12u%\x90\xb2\x05\xb4}\xad}\xc4MP\x8cmb\x0c\x88\xfd{)\x9b\xc0' +t4 = _tls_P_SHA1(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', b'\xcd'*50, 80) == b'\xd6\xe4\x8a\x91\xb3\xac\xe16\x9d\x10s\xf1\x1bu\x96(6f\xed\xd8x\x19\xcd<:\x15\xb2z\xc1\xa9\xdf\x89=\xeb!\xfb\n\x0e\xdf0\xb9\xb5\xa96\xcf\x9b\xd4\xcaD\x12Y1[p\xb9\xf9\xbb=\xa9\xcd\xb7\xe0L\xb00\xafK\xc4\x9c\xc6?#\xb6$\xebM\x1a\xba;3' +t5 = _tls_P_SHA1(b'\x0c'*20, "Test With Truncation", 80) == b'`\x1d\xe4\x98Q\xa1\xdbW\xc5a\xa9@\x8fQ\x86\xfc\x17\xca\xda\x1a\xdd\xb8\xab\x94M_Y\xd1%Pj\xfc\xd4\xca\x82\x88\xdb\x04\xf9F\xbe\xbf\xecR\xa4\x0c}[\x8e\xc7\xdf\x88I:\xea2v\xbe\x06\x8fcx\xf1Q\xb7z1\x1455?\xc0_\xda\xbb;\xa6Q\xb3\xc5' +t6 = _tls_P_SHA1(b'\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 80) == b'\x00W\xbaq>^\x047;\xcezY}\x16\xc6\xf10\x80:\xe2K\x87i{\xc7V\xad2\xda=\xf3d7\x047\xf7r\xf1&\x04\xb1\xd1\xf8\x88H\'\r\x08\xc4\x81\xa3\xa1Q\xa5\x90\xed\xef\xd8\x9c\x14\xdc\x80\xab){3\xde\x87\x8a\x1e"\x1e\xad54rM\x94\xe1\xb8' +t7 = _tls_P_SHA1(b'\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == b'N/PKC\x1d\xb5[}gUk\xc7\xaf\xb4-\xef\x9e\xe63$E=\xfc\xc4\xd0l]EA\x84\xb0\x1e\x91]\xcc[\x0e-\xec\xd5\x90\x19,\xc6\xffn\xf8\xbe1Ck\xe6\x9cF*\x8c"_\x05\x14%h\x98\xa1\xc2\xf1bCt\xd4S\xc1:{\x96\xa4\x14c ' t1 and t2 and t3 and t4 and t5 and t6 and t7 + Test _tls_PRF() = Crypto - _tls_PRF behavior on test vectors borrowed from RFC 2202 (+ errata) from scapy.layers.tls.crypto.prf import _tls_PRF -t1 = _tls_PRF('\x0b'*20, "Test Label XXXX", "Hi There", 80) == 'E\xcc\xeb\x12\x0b<\xbfh\x1f\xc3\xd3%J\x85\xdeQ\t\xbc[\xcd.\xbe\x170\xf2\xebm\xe6g\x05x\xad\x86V\x0b\xb3\xb7\xe5i\x7fh}T\xe5$\xe4\xba\xa0\xc6\xf0\xf1\xb1\xe1\x8a\xf5\xcc\x9ab\x1c\xc9\x10\x82\x93\x82Q\xd2\x80\xf0\xf8\x0f\x03\xe2\xbe\xc3\x94T\x05\xben\x9e' -t2 = _tls_PRF('Jefe', "Test Label YYYYYYY", "what do ya want for nothing?", 80) == 'n\xbet\x06\x82\x87\xcd\xea\xd9\x8b\xf8J\x17\x07\x84\xbc\xf3\x07\x9a\x99\n\xa6,\x97\xe6CRO\x7f\x0e[,\xa9\x83\xe6\xce?6\x12x\xc8Q\x00kO\x06s\xc5\xd7\xda\x1fd_\xe8\xad\xd4\xea\xfe\xd8\xc8 \x92e\x80\x8a\xafxF\xd6-/\x14\x94\x05a\x94\x0b\x1d\xf83' -t3 = _tls_PRF('\xaa'*20, "Test Label ZZ", '\xdd'*50, 80) == "Ad\xe2B\xa0\xb0+G#\x0f%\x19\xae\xdd\xb1d\xa0\x99\x15\x98\xa43c?\xaa\xd1\xc0\xf7\xc39V\xcb\x9b}\x95T\xd9\xde \xecr{/\xfb\x018\xeeR \x18Awi\x86=\xb4rg\x13\\\xaf<\x17\xd3_\xc5'U[\xa5\x83\xfa<\xa6\xc9\xdd\x85l\x1a\xdb" -t4 = _tls_PRF('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', "Test Label UUUUUUUUUUUUUUU", '\xcd'*50, 80) == '<\xf0\xe9\xaa\x95w\t\xa7\xb0!w\xf1EoC\x8fJ\x1f\xec\x80.\x89X\xe3O4Vl\xd1\xb7]\xa1\xb9o\xdf/&!\xb8n\xeb\x04"\xeftxs 6E+\xf1\xb3\xb6/vd\xd1h\xa3\x80>\x83Y\xbd]\xda\xab\xb8\xd8\x01\xc5b3K\xe7\x08\r\x12\x14' -t5 = _tls_PRF('\x0c'*20, "Test Label KKKKKKKKK", "Test With Truncation", 80) == "gq\xa5\xc4\xf5\x86z.\x03\n\xa3\x85\x87\xbc\xabm\xf1\xd2\x06\xf6\xbc\xc8\xab\xf0\xee\xd2>e'!\xd3zW\x81\x10|^(\x8d~\xa5s&p\xef]\rDa\x113\xa6z\x9f\xf2\xe2_}\xd8.u\xbe\xb1\x7fx\xe0r~\xdc\xa2\x0f\xcd\xcd\x1d\x81\x1a`#\xc6O" -t6 = _tls_PRF('\xaa'*80, "Test Label PPPPPPPPP", "Test Using Larger Than Block-Size Key - Hash Key First", 80) == '\x994^fx\x17\xbaaj\xc0"\xd1g\xbfh#uE\xee\xd8\xf1,\xab\xe7w\xfa\xc8\x0c\xf9\xcd\xbb\xbb\xa71U\xbe\xeb@\x90\xc2\x04\x93\xa5\xcf\x8e\xda\xbb\x93n\x99^\xa2{\x8b{\x18\xd7\xf7e\x8a~\xfbA\xdd\xc3\xd9\x9b\x1c\x82$\xf5YX{\xaa\xb4\xf2\x04\xb3%' -t7 = _tls_PRF('\xaa'*80, "Test Label MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == '\xd6N\x12S\x18]\x87\x19\xacD\x1b4\xc3"\xc2\xd9J\xb8\xee/\xb0?\xc2_\x10\xb2\x196\xdaXC\xe0Ft\xd3:a\xcd\xb8\xdd\x8a\xb6\xb1\xc6sx\xb8\x87\x8a\x93\xf8~\xad\xc7\xd1\xa7I=\xceVW\x0f\x9a\xcc-\x8cv^o\x12\xa4\xcd\x10\xb1\xb0\x1f\xdd\x94,\x03' +t1 = _tls_PRF(b'\x0b'*20, "Test Label XXXX", "Hi There", 80) == b'E\xcc\xeb\x12\x0b<\xbfh\x1f\xc3\xd3%J\x85\xdeQ\t\xbc[\xcd.\xbe\x170\xf2\xebm\xe6g\x05x\xad\x86V\x0b\xb3\xb7\xe5i\x7fh}T\xe5$\xe4\xba\xa0\xc6\xf0\xf1\xb1\xe1\x8a\xf5\xcc\x9ab\x1c\xc9\x10\x82\x93\x82Q\xd2\x80\xf0\xf8\x0f\x03\xe2\xbe\xc3\x94T\x05\xben\x9e' +t2 = _tls_PRF('Jefe', "Test Label YYYYYYY", "what do ya want for nothing?", 80) == b'n\xbet\x06\x82\x87\xcd\xea\xd9\x8b\xf8J\x17\x07\x84\xbc\xf3\x07\x9a\x99\n\xa6,\x97\xe6CRO\x7f\x0e[,\xa9\x83\xe6\xce?6\x12x\xc8Q\x00kO\x06s\xc5\xd7\xda\x1fd_\xe8\xad\xd4\xea\xfe\xd8\xc8 \x92e\x80\x8a\xafxF\xd6-/\x14\x94\x05a\x94\x0b\x1d\xf83' +t3 = _tls_PRF(b'\xaa'*20, "Test Label ZZ", b'\xdd'*50, 80) == b"Ad\xe2B\xa0\xb0+G#\x0f%\x19\xae\xdd\xb1d\xa0\x99\x15\x98\xa43c?\xaa\xd1\xc0\xf7\xc39V\xcb\x9b}\x95T\xd9\xde \xecr{/\xfb\x018\xeeR \x18Awi\x86=\xb4rg\x13\\\xaf<\x17\xd3_\xc5'U[\xa5\x83\xfa<\xa6\xc9\xdd\x85l\x1a\xdb" +t4 = _tls_PRF(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', "Test Label UUUUUUUUUUUUUUU", b'\xcd'*50, 80) == b'<\xf0\xe9\xaa\x95w\t\xa7\xb0!w\xf1EoC\x8fJ\x1f\xec\x80.\x89X\xe3O4Vl\xd1\xb7]\xa1\xb9o\xdf/&!\xb8n\xeb\x04"\xeftxs 6E+\xf1\xb3\xb6/vd\xd1h\xa3\x80>\x83Y\xbd]\xda\xab\xb8\xd8\x01\xc5b3K\xe7\x08\r\x12\x14' +t5 = _tls_PRF(b'\x0c'*20, "Test Label KKKKKKKKK", "Test With Truncation", 80) == b"gq\xa5\xc4\xf5\x86z.\x03\n\xa3\x85\x87\xbc\xabm\xf1\xd2\x06\xf6\xbc\xc8\xab\xf0\xee\xd2>e'!\xd3zW\x81\x10|^(\x8d~\xa5s&p\xef]\rDa\x113\xa6z\x9f\xf2\xe2_}\xd8.u\xbe\xb1\x7fx\xe0r~\xdc\xa2\x0f\xcd\xcd\x1d\x81\x1a`#\xc6O" +t6 = _tls_PRF(b'\xaa'*80, "Test Label PPPPPPPPP", "Test Using Larger Than Block-Size Key - Hash Key First", 80) == b'\x994^fx\x17\xbaaj\xc0"\xd1g\xbfh#uE\xee\xd8\xf1,\xab\xe7w\xfa\xc8\x0c\xf9\xcd\xbb\xbb\xa71U\xbe\xeb@\x90\xc2\x04\x93\xa5\xcf\x8e\xda\xbb\x93n\x99^\xa2{\x8b{\x18\xd7\xf7e\x8a~\xfbA\xdd\xc3\xd9\x9b\x1c\x82$\xf5YX{\xaa\xb4\xf2\x04\xb3%' +t7 = _tls_PRF(b'\xaa'*80, "Test Label MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == b'\xd6N\x12S\x18]\x87\x19\xacD\x1b4\xc3"\xc2\xd9J\xb8\xee/\xb0?\xc2_\x10\xb2\x196\xdaXC\xe0Ft\xd3:a\xcd\xb8\xdd\x8a\xb6\xb1\xc6sx\xb8\x87\x8a\x93\xf8~\xad\xc7\xd1\xa7I=\xceVW\x0f\x9a\xcc-\x8cv^o\x12\xa4\xcd\x10\xb1\xb0\x1f\xdd\x94,\x03' t1 and t2 and t3 and t4 and t5 and t6 and t7 + Test _ssl_PRF() = Crypto - _ssl_PRF behavior on test vectors from scapy.layers.tls.crypto.prf import _ssl_PRF -t1 = _ssl_PRF('\x0b'*20, "Hi There", 80) == '\x0fo\xbe9\x83>~Bc\xaea^\x86\xd2b\x94X\xfd9Be\xe799\xf2\x00\xfcS\xd6\x1c=\xe5\x7fin\x1e\xf9r\xc8\xe6k\x19K\x8a\x85SK\xe5\xb7;A\x19b\x86F3M\x8d=\xcf\x15\xeedo\xd3\xae\xa2\x95\x8e\x80\x13\xabG\x8d\x1c,\x8c\xab\xf7\xd4' -t2 = _ssl_PRF('Jefe', "what do ya want for nothing?", 80) == '\x19\x9f\xb9{\x87.\xd0\xf5\xc4\t.\xb6#\xae\x95\xe0S~\x15\xce\xe6\xb7oe\xad\x127\xb8\xc2C?\r\x87\xa6\x7f\x86y\xfa\xae\xcf\x0e\xb9\x01\xa5B\x07\x9d\x95\xf1]\xdc\x1bCb&T\xa0\xb0\x8a3\xcf\\\xaf\xe8j/\xbdx\x13\\\x91\xc8\xdfZ\xde"R`K\xd6' -t3 = _ssl_PRF('\xaa'*20, '\xdd'*50, 80) == '\xe3*\xce\xdc?k{\x10\x80\x8dt\x0e\xdaA\xf9}\x1d\x8e|\xc9Ux\x88\\\xf1a\xcfJ\xedi\xc1[C-\xf3\xa4\xcc\xf9\xce\xa3P\xe3\x9ai\x0b\xb7\xce\x8bar\x93\xc5\x93\x1a\x82\xc8{\x1c\xf2\x87\x9d\xe1\xf5\x9e\x0c\xf6\xa6\x91\xb9\x97\x17Y,\x11\x00\rs\xdd\xcf]' -t4 = _ssl_PRF('\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', '\xcd'*50, 80) == "\x8c\x83!h\x1b\xf2\x96f\x04\x15\x80H\x88\xcb\x80\x03\xc0\xfc\x05\xe5q\x93]\xeb\t\xd4B\xbc\xa4{\xb9\xd8\xb6IF\xc2\x80\x87\x9e2*\x82\x0ef\xc8\xbbBi\xb15\x90\xd6MW\xebM\xd7\xf9u\xd5+\xa8\x81\x11'\x8c\x88]b\r,\xde\xd9d[t\t\x199\x0b" -t5 = _ssl_PRF('\x0c'*20, "Test With Truncation", 80) == "\x85\xf5\xe8\xd2\xddW$\x14\xde\x84\x08@\xca\x86\x8bZn\x07\x87AKg\x18\xc3\x1a'\xc2\xb9\xdd\x17\xb5K1\xb9\x9a=\xe4\x1f/\xfe\xa6\x96\x10\x0c\x15@:z\xbf\x1dM\xa3\x90\x01\xb67\x07Z\xe0\xfe}U=\x81\xb2~\xc6\x1a\xcb\xe7\x9b\x90+\xa0\x86\xb2\x8b\xae\xc7\x9f" -t6 = _ssl_PRF('\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 80) == '\x99\x11\x92\x8dw\xf1\xab\xdfr\x96S\xf5\xc1\x96\xc0\x16W*=\xa49\xd0\xf0\xf15\x91le\xda\x16\xfe8\x834kC3\x1b\xdf\xfc\xd8\x82\xe1\x9c\xfe9(4\xf9\x9c\x12\xc5~\xd1\xdc\xf3\xe5\x91\xbd\xbb\xb5$\x1c\xe4fs\xf2\xedM\xb7pO\x17\xdf\x01K\xf8\xed2-' -t7 = _ssl_PRF('\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == "\x8esl|C\x81\x80vv\xe1\x89H\xc9'oC\x1b\xbe\xc3\xbbE\x04)\xed\x1c\x84\xa9)\x08\xf5\xeb-\x93\xe9\x0f}\xeb[\xc4w\xd53y$\x07\xdc\x0f\\\xfc\xb2\x05r+\x13\xd8\xc3\xe7Lsz\xa1\x03\x93\xdd-\xf9l\xb7\xe6\xb3\x7fM\xfa\x90\xadeo\xcer*" +t1 = _ssl_PRF(b'\x0b'*20, "Hi There", 80) == b'\x0fo\xbe9\x83>~Bc\xaea^\x86\xd2b\x94X\xfd9Be\xe799\xf2\x00\xfcS\xd6\x1c=\xe5\x7fin\x1e\xf9r\xc8\xe6k\x19K\x8a\x85SK\xe5\xb7;A\x19b\x86F3M\x8d=\xcf\x15\xeedo\xd3\xae\xa2\x95\x8e\x80\x13\xabG\x8d\x1c,\x8c\xab\xf7\xd4' +t2 = _ssl_PRF('Jefe', "what do ya want for nothing?", 80) == b'\x19\x9f\xb9{\x87.\xd0\xf5\xc4\t.\xb6#\xae\x95\xe0S~\x15\xce\xe6\xb7oe\xad\x127\xb8\xc2C?\r\x87\xa6\x7f\x86y\xfa\xae\xcf\x0e\xb9\x01\xa5B\x07\x9d\x95\xf1]\xdc\x1bCb&T\xa0\xb0\x8a3\xcf\\\xaf\xe8j/\xbdx\x13\\\x91\xc8\xdfZ\xde"R`K\xd6' +t3 = _ssl_PRF(b'\xaa'*20, b'\xdd'*50, 80) == b'\xe3*\xce\xdc?k{\x10\x80\x8dt\x0e\xdaA\xf9}\x1d\x8e|\xc9Ux\x88\\\xf1a\xcfJ\xedi\xc1[C-\xf3\xa4\xcc\xf9\xce\xa3P\xe3\x9ai\x0b\xb7\xce\x8bar\x93\xc5\x93\x1a\x82\xc8{\x1c\xf2\x87\x9d\xe1\xf5\x9e\x0c\xf6\xa6\x91\xb9\x97\x17Y,\x11\x00\rs\xdd\xcf]' +t4 = _ssl_PRF(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19', b'\xcd'*50, 80) == b"\x8c\x83!h\x1b\xf2\x96f\x04\x15\x80H\x88\xcb\x80\x03\xc0\xfc\x05\xe5q\x93]\xeb\t\xd4B\xbc\xa4{\xb9\xd8\xb6IF\xc2\x80\x87\x9e2*\x82\x0ef\xc8\xbbBi\xb15\x90\xd6MW\xebM\xd7\xf9u\xd5+\xa8\x81\x11'\x8c\x88]b\r,\xde\xd9d[t\t\x199\x0b" +t5 = _ssl_PRF(b'\x0c'*20, "Test With Truncation", 80) == b"\x85\xf5\xe8\xd2\xddW$\x14\xde\x84\x08@\xca\x86\x8bZn\x07\x87AKg\x18\xc3\x1a'\xc2\xb9\xdd\x17\xb5K1\xb9\x9a=\xe4\x1f/\xfe\xa6\x96\x10\x0c\x15@:z\xbf\x1dM\xa3\x90\x01\xb67\x07Z\xe0\xfe}U=\x81\xb2~\xc6\x1a\xcb\xe7\x9b\x90+\xa0\x86\xb2\x8b\xae\xc7\x9f" +t6 = _ssl_PRF(b'\xaa'*80, "Test Using Larger Than Block-Size Key - Hash Key First", 80) == b'\x99\x11\x92\x8dw\xf1\xab\xdfr\x96S\xf5\xc1\x96\xc0\x16W*=\xa49\xd0\xf0\xf15\x91le\xda\x16\xfe8\x834kC3\x1b\xdf\xfc\xd8\x82\xe1\x9c\xfe9(4\xf9\x9c\x12\xc5~\xd1\xdc\xf3\xe5\x91\xbd\xbb\xb5$\x1c\xe4fs\xf2\xedM\xb7pO\x17\xdf\x01K\xf8\xed2-' +t7 = _ssl_PRF(b'\xaa'*80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", 80) == b"\x8esl|C\x81\x80vv\xe1\x89H\xc9'oC\x1b\xbe\xc3\xbbE\x04)\xed\x1c\x84\xa9)\x08\xf5\xeb-\x93\xe9\x0f}\xeb[\xc4w\xd53y$\x07\xdc\x0f\\\xfc\xb2\x05r+\x13\xd8\xc3\xe7Lsz\xa1\x03\x93\xdd-\xf9l\xb7\xe6\xb3\x7fM\xfa\x90\xadeo\xcer*" t1 and t2 and t3 and t4 and t5 and t6 and t7 @@ -309,24 +309,24 @@ t1 and t2 and t3 and t4 and t5 and t6 and t7 from scapy.layers.tls.crypto.prf import PRF class _prf_tls12_sha256_test: h= "SHA256" - k= "\x9b\xbe\x43\x6b\xa9\x40\xf0\x17\xb1\x76\x52\x84\x9a\x71\xdb\x35" - s= "\xa0\xba\x9f\x93\x6c\xda\x31\x18\x27\xa6\xf7\x96\xff\xd5\x19\x8c" - o=("\xe3\xf2\x29\xba\x72\x7b\xe1\x7b\x8d\x12\x26\x20\x55\x7c\xd4\x53" + - "\xc2\xaa\xb2\x1d\x07\xc3\xd4\x95\x32\x9b\x52\xd4\xe6\x1e\xdb\x5a") + k= b"\x9b\xbe\x43\x6b\xa9\x40\xf0\x17\xb1\x76\x52\x84\x9a\x71\xdb\x35" + s= b"\xa0\xba\x9f\x93\x6c\xda\x31\x18\x27\xa6\xf7\x96\xff\xd5\x19\x8c" + o=(b"\xe3\xf2\x29\xba\x72\x7b\xe1\x7b\x8d\x12\x26\x20\x55\x7c\xd4\x53" + + b"\xc2\xaa\xb2\x1d\x07\xc3\xd4\x95\x32\x9b\x52\xd4\xe6\x1e\xdb\x5a") class _prf_tls12_sha384_test: h= "SHA384" - k= "\xb8\x0b\x73\x3d\x6c\xee\xfc\xdc\x71\x56\x6e\xa4\x8e\x55\x67\xdf" - s= "\xcd\x66\x5c\xf6\xa8\x44\x7d\xd6\xff\x8b\x27\x55\x5e\xdb\x74\x65" - o=("\x7b\x0c\x18\xe9\xce\xd4\x10\xed\x18\x04\xf2\xcf\xa3\x4a\x33\x6a" + - "\x1c\x14\xdf\xfb\x49\x00\xbb\x5f\xd7\x94\x21\x07\xe8\x1c\x83\xcd") + k= b"\xb8\x0b\x73\x3d\x6c\xee\xfc\xdc\x71\x56\x6e\xa4\x8e\x55\x67\xdf" + s= b"\xcd\x66\x5c\xf6\xa8\x44\x7d\xd6\xff\x8b\x27\x55\x5e\xdb\x74\x65" + o=(b"\x7b\x0c\x18\xe9\xce\xd4\x10\xed\x18\x04\xf2\xcf\xa3\x4a\x33\x6a" + + b"\x1c\x14\xdf\xfb\x49\x00\xbb\x5f\xd7\x94\x21\x07\xe8\x1c\x83\xcd") class _prf_tls12_sha512_test: h= "SHA512" - k= "\xb0\x32\x35\x23\xc1\x85\x35\x99\x58\x4d\x88\x56\x8b\xbb\x05\xeb" - s= "\xd4\x64\x0e\x12\xe4\xbc\xdb\xfb\x43\x7f\x03\xe6\xae\x41\x8e\xe5" - o=("\x12\x61\xf5\x88\xc7\x98\xc5\xc2\x01\xff\x03\x6e\x7a\x9c\xb5\xed" + - "\xcd\x7f\xe3\xf9\x4c\x66\x9a\x12\x2a\x46\x38\xd7\xd5\x08\xb2\x83") + k= b"\xb0\x32\x35\x23\xc1\x85\x35\x99\x58\x4d\x88\x56\x8b\xbb\x05\xeb" + s= b"\xd4\x64\x0e\x12\xe4\xbc\xdb\xfb\x43\x7f\x03\xe6\xae\x41\x8e\xe5" + o=(b"\x12\x61\xf5\x88\xc7\x98\xc5\xc2\x01\xff\x03\x6e\x7a\x9c\xb5\xed" + + b"\xcd\x7f\xe3\xf9\x4c\x66\x9a\x12\x2a\x46\x38\xd7\xd5\x08\xb2\x83") def _all_prf_tls12_tests(): res = True @@ -344,19 +344,19 @@ _all_prf_tls12_tests() + Test compute_master_secret() for SSL = Crypto - compute_master_secret() in SSL mode f = PRF(tls_version=0x300) -t1 = f.compute_master_secret("A"*48, "B"*32, "C"*32) == '\xe8\xb5O68e\x8c\x1e\xd0hD!\xc1Zk\x9e\xc7x3\xfc".\xf9\x17\xd5B\xfc\xef\x8d\xed\x9fP\xcer\x83|6\x02\xe0\x86\xda\xab-G\x8c\xa9H5' -t2 = f.compute_master_secret("A"*48, "C"*32, "B"*32) == 'Ts/q\x83\x88\x10\x9c1Y\xff\xf3vo\xe3\x8aM\x9b\xa3k[J\xeeWXs\xcfTe\x19\xc6\xb1\x0ebj1}\x0c\xca\x97=|\x88W\xd8q\xfb|' -t3 = f.compute_master_secret("C"*48, "A"*32, "B"*32) == 'Q\xde\x06L\xdb\xe9\x9dC\x19\x8a:m@\xce\xbf\xc0\n\xd8\xd4H!#\x06\xad\x929\x85\xc9@\x1f\xb5\xe2)^{c\x94\x06&\xad\xb56\x13^\xd6\xa5\x19\xe7' -t4 = f.compute_master_secret("D"*48, "B"*32, "A"*32) == '\xbe\x9a\xc8)\xb5{.H1\x8382\xc2\xdff\xdf@\xda\xde\x88\xe1\xf3\xad9\xcc\x14\xb1\x7f\x90\x00;B)\x8c\xdb\xdbH\xfe=%^\xe9\x83\x0eV\x86\x83\x8d' +t1 = f.compute_master_secret("A"*48, "B"*32, "C"*32) == b'\xe8\xb5O68e\x8c\x1e\xd0hD!\xc1Zk\x9e\xc7x3\xfc".\xf9\x17\xd5B\xfc\xef\x8d\xed\x9fP\xcer\x83|6\x02\xe0\x86\xda\xab-G\x8c\xa9H5' +t2 = f.compute_master_secret("A"*48, "C"*32, "B"*32) == b'Ts/q\x83\x88\x10\x9c1Y\xff\xf3vo\xe3\x8aM\x9b\xa3k[J\xeeWXs\xcfTe\x19\xc6\xb1\x0ebj1}\x0c\xca\x97=|\x88W\xd8q\xfb|' +t3 = f.compute_master_secret("C"*48, "A"*32, "B"*32) == b'Q\xde\x06L\xdb\xe9\x9dC\x19\x8a:m@\xce\xbf\xc0\n\xd8\xd4H!#\x06\xad\x929\x85\xc9@\x1f\xb5\xe2)^{c\x94\x06&\xad\xb56\x13^\xd6\xa5\x19\xe7' +t4 = f.compute_master_secret("D"*48, "B"*32, "A"*32) == b'\xbe\x9a\xc8)\xb5{.H1\x8382\xc2\xdff\xdf@\xda\xde\x88\xe1\xf3\xad9\xcc\x14\xb1\x7f\x90\x00;B)\x8c\xdb\xdbH\xfe=%^\xe9\x83\x0eV\x86\x83\x8d' t1 and t2 and t3 and t4 + Test derive_key_block() for SSL = Crypto - derive_key_block() in SSL mode -t1 = f.derive_key_block("A"*48, "B"*32, "C"*32, 72) == '\xe8\xb5O68e\x8c\x1e\xd0hD!\xc1Zk\x9e\xc7x3\xfc".\xf9\x17\xd5B\xfc\xef\x8d\xed\x9fP\xcer\x83|6\x02\xe0\x86\xda\xab-G\x8c\xa9H5\xdf\x14\xa9\xcfV\r\xea}\x98\x04\x8dK,\xb6\xf7;\xaa\xa8\xa5\xad\x7f\x0fCY' -t2 = f.derive_key_block("A"*48, "C"*32, "B"*32, 72) == 'Ts/q\x83\x88\x10\x9c1Y\xff\xf3vo\xe3\x8aM\x9b\xa3k[J\xeeWXs\xcfTe\x19\xc6\xb1\x0ebj1}\x0c\xca\x97=|\x88W\xd8q\xfb|\x17\x99\nH;\xec\xd2\x15\xabd\xed\xc3\xe0p\xd8\x1eS\xb5\xf4*8\xceE^' -t3 = f.derive_key_block("C"*48, "A"*32, "B"*32, 72) == 'Q\xde\x06L\xdb\xe9\x9dC\x19\x8a:m@\xce\xbf\xc0\n\xd8\xd4H!#\x06\xad\x929\x85\xc9@\x1f\xb5\xe2)^{c\x94\x06&\xad\xb56\x13^\xd6\xa5\x19\xe7\xed\xd6\x92\xe0O\x0e\xbf\xc6\x97\x9f~\x95\xcf\xb0\xe7a\x1d\xbc]\xf4&Z\x81J' -t4 = f.derive_key_block("D"*48, "B"*32, "A"*32, 72) == '\xbe\x9a\xc8)\xb5{.H1\x8382\xc2\xdff\xdf@\xda\xde\x88\xe1\xf3\xad9\xcc\x14\xb1\x7f\x90\x00;B)\x8c\xdb\xdbH\xfe=%^\xe9\x83\x0eV\x86\x83\x8d\xeal\x8ea\x08\x9d\xb3\xf3\xf4\xa6[\'j\xda\rT"\x10\xa5Z\n\xc0r\xf3' +t1 = f.derive_key_block("A"*48, "B"*32, "C"*32, 72) == b'\xe8\xb5O68e\x8c\x1e\xd0hD!\xc1Zk\x9e\xc7x3\xfc".\xf9\x17\xd5B\xfc\xef\x8d\xed\x9fP\xcer\x83|6\x02\xe0\x86\xda\xab-G\x8c\xa9H5\xdf\x14\xa9\xcfV\r\xea}\x98\x04\x8dK,\xb6\xf7;\xaa\xa8\xa5\xad\x7f\x0fCY' +t2 = f.derive_key_block("A"*48, "C"*32, "B"*32, 72) == b'Ts/q\x83\x88\x10\x9c1Y\xff\xf3vo\xe3\x8aM\x9b\xa3k[J\xeeWXs\xcfTe\x19\xc6\xb1\x0ebj1}\x0c\xca\x97=|\x88W\xd8q\xfb|\x17\x99\nH;\xec\xd2\x15\xabd\xed\xc3\xe0p\xd8\x1eS\xb5\xf4*8\xceE^' +t3 = f.derive_key_block("C"*48, "A"*32, "B"*32, 72) == b'Q\xde\x06L\xdb\xe9\x9dC\x19\x8a:m@\xce\xbf\xc0\n\xd8\xd4H!#\x06\xad\x929\x85\xc9@\x1f\xb5\xe2)^{c\x94\x06&\xad\xb56\x13^\xd6\xa5\x19\xe7\xed\xd6\x92\xe0O\x0e\xbf\xc6\x97\x9f~\x95\xcf\xb0\xe7a\x1d\xbc]\xf4&Z\x81J' +t4 = f.derive_key_block("D"*48, "B"*32, "A"*32, 72) == b'\xbe\x9a\xc8)\xb5{.H1\x8382\xc2\xdff\xdf@\xda\xde\x88\xe1\xf3\xad9\xcc\x14\xb1\x7f\x90\x00;B)\x8c\xdb\xdbH\xfe=%^\xe9\x83\x0eV\x86\x83\x8d\xeal\x8ea\x08\x9d\xb3\xf3\xf4\xa6[\'j\xda\rT"\x10\xa5Z\n\xc0r\xf3' t1 and t2 and t3 and t4 @@ -364,19 +364,19 @@ t1 and t2 and t3 and t4 = Crypto - compute_master_secret() in TLS 1.0 mode from scapy.layers.tls.crypto.prf import PRF f = PRF(tls_version=0x301) -t1 = f.compute_master_secret("A"*48, "B"*32, "C"*32) == "k\\[e\x11\xab\xfe6\trN\x9e\x8d\xb09{\x17\x8d\x9f\xc6_' G\x05\x08}\xf7Q\x8e\xcb\xff\x00\xfc7\xd0\xf0z\xea\x8b\x98%\x90\x89sd\x98\xa1" -t2 = f.compute_master_secret("A"*48, "C"*32, "B"*32) == 'k\xd2\xf7\x1aqt\xa4~\x9bqf\x0f:\xc4%\x9a\x07\x17\x14\xf4\xdf&)*\x1c\x9c8\x8em\xe1\x13\x17\xa7\xd2\x051Q<M~\xc2a\x85\x82\xe6\xd7.[' -t3 = f.compute_master_secret("C"*48, "A"*32, "B"*32) == '\xe57\xae.,B\xeb(/?\xf4tR#\xd0\xa9"\xf7-\x9d\x0e\xd7\xd9\x1c\x1f\x9b\x95\xe6\xd0\x0e(\x06W7s(^"x\xbb\xdb\xb6\xae\xf75J\x0f\xbf' -t4 = f.compute_master_secret("D"*48, "B"*32, "A"*32) == '\xeb3\xf5Ty\x08xqP\x01p\x12\x95\xd4\xf5y{\xe7\xea5\nS\xb1T\xea\xe3d\x8b\xd7\xb89\xcf\xb9\xe0l\x95d\xbd-\x97\xea\xf20n\x96t\xfe\xff' +t1 = f.compute_master_secret("A"*48, "B"*32, "C"*32) == b"k\\[e\x11\xab\xfe6\trN\x9e\x8d\xb09{\x17\x8d\x9f\xc6_' G\x05\x08}\xf7Q\x8e\xcb\xff\x00\xfc7\xd0\xf0z\xea\x8b\x98%\x90\x89sd\x98\xa1" +t2 = f.compute_master_secret("A"*48, "C"*32, "B"*32) == b'k\xd2\xf7\x1aqt\xa4~\x9bqf\x0f:\xc4%\x9a\x07\x17\x14\xf4\xdf&)*\x1c\x9c8\x8em\xe1\x13\x17\xa7\xd2\x051Q<M~\xc2a\x85\x82\xe6\xd7.[' +t3 = f.compute_master_secret("C"*48, "A"*32, "B"*32) == b'\xe57\xae.,B\xeb(/?\xf4tR#\xd0\xa9"\xf7-\x9d\x0e\xd7\xd9\x1c\x1f\x9b\x95\xe6\xd0\x0e(\x06W7s(^"x\xbb\xdb\xb6\xae\xf75J\x0f\xbf' +t4 = f.compute_master_secret("D"*48, "B"*32, "A"*32) == b'\xeb3\xf5Ty\x08xqP\x01p\x12\x95\xd4\xf5y{\xe7\xea5\nS\xb1T\xea\xe3d\x8b\xd7\xb89\xcf\xb9\xe0l\x95d\xbd-\x97\xea\xf20n\x96t\xfe\xff' t1 and t2 and t3 and t4 + Test derive_key_block() for TLS 1.0 = Crypto - derive_key_block() in TLS 1.0 mode -t1 = f.derive_key_block("A"*48, "B"*32, "C"*32, 72) == '\x06\xccA\xd5\xf3\x9dT`ZC!/\xa0\xbe\x95\x86m\xdb@\x18\xfb\x95\xad\xcd\xac<(K\x88\xacB\x92s\x8d7AVG\xf04\x0be\x8dv\x02\xd6\x03\x7f\xe4\x8eYe\x88\xb7YI\xc2\xf0!\x1dSx\x86\xdeY\x81\x89\x11\xa6\xd9\xd1\xed' -t2 = f.derive_key_block("A"*48, "C"*32, "B"*32, 72) == "\\@d\x1d9V\xae\xe2'\xf6Q\xc9\xd7\x8beu\xe8u\xd9\xe8\r\x18a\x8c|\xde\x95H\xec\xc5}I\xf9s(e\xe4\x87*s\x98=\x96wsj\xfe\x0euo\x1f\\1hh-\x0f\xda9\x9etk\x0fW\x03\xe2k\xb0\x87Pb3" -t3 = f.derive_key_block("C"*48, "A"*32, "B"*32, 72) == '\x9c\xaate\x07\x12K\xb2\xc3zT1\xf4\x1fN\xa8\x03\xbd\xcfF_\x0c\x0bF\x14\x8f\xcf\x08c\xa6\x80\x1d\xd8Wh.E\xf5\x9a\xfd\x1d\x8a6\xf7\x950\xf4\xbcm\x89\xa6!\x7fc\x19D\xb4\xcc\x8f\xf7x\x12\xe0q\x17\x84-\xcc[\x7f@p' -t4 = f.derive_key_block("D"*48, "B"*32, "A"*32, 72) == 't{P+k\xe1\xe5O\xbe]L?$\x8d7O.\xe6\xd6\xa8\x19U\x87\x04%\x13m+_\xb9\x99\x03\xe1\xfd1]*7\x8d\xa0Xx\xa1\xd1\xfe\x0c\xb1\xb1\xa8\xdd\x0c\xb20@v\xb6\xdc\x86d\n\x8a-\x95\xaeL\x97\xfaFjl\xfb^' +t1 = f.derive_key_block("A"*48, "B"*32, "C"*32, 72) == b'\x06\xccA\xd5\xf3\x9dT`ZC!/\xa0\xbe\x95\x86m\xdb@\x18\xfb\x95\xad\xcd\xac<(K\x88\xacB\x92s\x8d7AVG\xf04\x0be\x8dv\x02\xd6\x03\x7f\xe4\x8eYe\x88\xb7YI\xc2\xf0!\x1dSx\x86\xdeY\x81\x89\x11\xa6\xd9\xd1\xed' +t2 = f.derive_key_block("A"*48, "C"*32, "B"*32, 72) == b"\\@d\x1d9V\xae\xe2'\xf6Q\xc9\xd7\x8beu\xe8u\xd9\xe8\r\x18a\x8c|\xde\x95H\xec\xc5}I\xf9s(e\xe4\x87*s\x98=\x96wsj\xfe\x0euo\x1f\\1hh-\x0f\xda9\x9etk\x0fW\x03\xe2k\xb0\x87Pb3" +t3 = f.derive_key_block("C"*48, "A"*32, "B"*32, 72) == b'\x9c\xaate\x07\x12K\xb2\xc3zT1\xf4\x1fN\xa8\x03\xbd\xcfF_\x0c\x0bF\x14\x8f\xcf\x08c\xa6\x80\x1d\xd8Wh.E\xf5\x9a\xfd\x1d\x8a6\xf7\x950\xf4\xbcm\x89\xa6!\x7fc\x19D\xb4\xcc\x8f\xf7x\x12\xe0q\x17\x84-\xcc[\x7f@p' +t4 = f.derive_key_block("D"*48, "B"*32, "A"*32, 72) == b't{P+k\xe1\xe5O\xbe]L?$\x8d7O.\xe6\xd6\xa8\x19U\x87\x04%\x13m+_\xb9\x99\x03\xe1\xfd1]*7\x8d\xa0Xx\xa1\xd1\xfe\x0c\xb1\xb1\xa8\xdd\x0c\xb20@v\xb6\xdc\x86d\n\x8a-\x95\xaeL\x97\xfaFjl\xfb^' t1 and t2 and t3 and t4 @@ -388,29 +388,29 @@ t1 and t2 and t3 and t4 = Crypto - RC4 stream cipher, encryption/decryption checks from RFC 6229 class _rc4_40_test: - k= "\x01\x02\x03\x04\x05" - s=("\xb2\x39\x63\x05\xf0\x3d\xc0\x27\xcc\xc3\x52\x4a\x0a\x11\x18\xa8" + - "\x69\x82\x94\x4f\x18\xfc\x82\xd5\x89\xc4\x03\xa4\x7a\x0d\x09\x19") - s_1024= "\x30\xab\xbc\xc7\xc2\x0b\x01\x60\x9f\x23\xee\x2d\x5f\x6b\xb7\xdf" + k= b"\x01\x02\x03\x04\x05" + s=(b"\xb2\x39\x63\x05\xf0\x3d\xc0\x27\xcc\xc3\x52\x4a\x0a\x11\x18\xa8" + + b"\x69\x82\x94\x4f\x18\xfc\x82\xd5\x89\xc4\x03\xa4\x7a\x0d\x09\x19") + s_1024= b"\x30\xab\xbc\xc7\xc2\x0b\x01\x60\x9f\x23\xee\x2d\x5f\x6b\xb7\xdf" class _rc4_128_test: - k= "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" - s=("\x9a\xc7\xcc\x9a\x60\x9d\x1e\xf7\xb2\x93\x28\x99\xcd\xe4\x1b\x97" - "\x52\x48\xc4\x95\x90\x14\x12\x6a\x6e\x8a\x84\xf1\x1d\x1a\x9e\x1c") - s_1024="\xbd\xf0\x32\x4e\x60\x83\xdc\xc6\xd3\xce\xdd\x3c\xa8\xc5\x3c\x16" + k= b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" + s=(b"\x9a\xc7\xcc\x9a\x60\x9d\x1e\xf7\xb2\x93\x28\x99\xcd\xe4\x1b\x97" + b"\x52\x48\xc4\x95\x90\x14\x12\x6a\x6e\x8a\x84\xf1\x1d\x1a\x9e\x1c") + s_1024=b"\xbd\xf0\x32\x4e\x60\x83\xdc\xc6\xd3\xce\xdd\x3c\xa8\xc5\x3c\x16" def _all_rc4_tests(): from scapy.layers.tls.crypto.cipher_stream import (Cipher_RC4_40, Cipher_RC4_128) res = True t = _rc4_40_test - c = Cipher_RC4_40(t.k).encrypt("\x00"*(1024+16)) + c = Cipher_RC4_40(t.k).encrypt(b"\x00"*(1024+16)) res = res and (c[:32] == t.s) and (c[-16:] == t.s_1024) - res = res and Cipher_RC4_40(t.k).decrypt(t.s) == "\x00"*32 + res = res and Cipher_RC4_40(t.k).decrypt(t.s) == b"\x00"*32 t = _rc4_128_test - c = Cipher_RC4_128(t.k).encrypt("\x00"*(1024+16)) + c = Cipher_RC4_128(t.k).encrypt(b"\x00"*(1024+16)) res = res and (c[:32] == t.s) and (c[-16:] == t.s_1024) - res = res and Cipher_RC4_128(t.k).decrypt(t.s) == "\x00"*32 + res = res and Cipher_RC4_128(t.k).decrypt(t.s) == b"\x00"*32 return res _all_rc4_tests() @@ -441,36 +441,36 @@ _all_aes_cbc_tests() = Crypto - AES cipher in CBC mode, checks from RFC 3602 class _aes128cbc_test_1: - k= "\x06\xa9\x21\x40\x36\xb8\xa1\x5b\x51\x2e\x03\xd5\x34\x12\x00\x06" + k= b"\x06\xa9\x21\x40\x36\xb8\xa1\x5b\x51\x2e\x03\xd5\x34\x12\x00\x06" p= "Single block msg" - c= "\xe3\x53\x77\x9c\x10\x79\xae\xb8\x27\x08\x94\x2d\xbe\x77\x18\x1a" - iv="\x3d\xaf\xba\x42\x9d\x9e\xb4\x30\xb4\x22\xda\x80\x2c\x9f\xac\x41" + c= b"\xe3\x53\x77\x9c\x10\x79\xae\xb8\x27\x08\x94\x2d\xbe\x77\x18\x1a" + iv=b"\x3d\xaf\xba\x42\x9d\x9e\xb4\x30\xb4\x22\xda\x80\x2c\x9f\xac\x41" class _aes128cbc_test_2: - k= "\x56\xe4\x7a\x38\xc5\x59\x89\x74\xbc\x46\x90\x3d\xba\x29\x03\x49" - p=("\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf") - c=("\xc3\x0e\x32\xff\xed\xc0\x77\x4e\x6a\xff\x6a\xf0\x86\x9f\x71\xaa" + - "\x0f\x3a\xf0\x7a\x9a\x31\xa9\xc6\x84\xdb\x20\x7e\xb0\xef\x8e\x4e" + - "\x35\x90\x7a\xa6\x32\xc3\xff\xdf\x86\x8b\xb7\xb2\x9d\x3d\x46\xad" + - "\x83\xce\x9f\x9a\x10\x2e\xe9\x9d\x49\xa5\x3e\x87\xf4\xc3\xda\x55") - iv="\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c\x44\x69\x9e\xd7\xdb\x51\xb7\xd9" + k= b"\x56\xe4\x7a\x38\xc5\x59\x89\x74\xbc\x46\x90\x3d\xba\x29\x03\x49" + p=(b"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" + + b"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + + b"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" + + b"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf") + c=(b"\xc3\x0e\x32\xff\xed\xc0\x77\x4e\x6a\xff\x6a\xf0\x86\x9f\x71\xaa" + + b"\x0f\x3a\xf0\x7a\x9a\x31\xa9\xc6\x84\xdb\x20\x7e\xb0\xef\x8e\x4e" + + b"\x35\x90\x7a\xa6\x32\xc3\xff\xdf\x86\x8b\xb7\xb2\x9d\x3d\x46\xad" + + b"\x83\xce\x9f\x9a\x10\x2e\xe9\x9d\x49\xa5\x3e\x87\xf4\xc3\xda\x55") + iv=b"\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c\x44\x69\x9e\xd7\xdb\x51\xb7\xd9" class _aes256cbc_test_1: - k=("\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81" + - "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4") - p= "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a" - c= "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6" - iv="\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + k=(b"\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81" + + b"\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4") + p= b"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + c= b"\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6" + iv=b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" class _aes256cbc_test_2: - k=("\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81" + - "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4") - p= "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10" - c= "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc\xda\x6c\x19\x07\x8c\x6a\x9d\x1b" - iv="\x39\xF2\x33\x69\xA9\xD9\xBA\xCF\xA5\x30\xE2\x63\x04\x23\x14\x61" + k=(b"\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81" + + b"\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4") + p= b"\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10" + c= b"\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc\xda\x6c\x19\x07\x8c\x6a\x9d\x1b" + iv=b"\x39\xF2\x33\x69\xA9\xD9\xBA\xCF\xA5\x30\xE2\x63\x04\x23\x14\x61" def _all_aes_cbc_tests(): from scapy.layers.tls.crypto.cipher_block import (Cipher_AES_128_CBC, @@ -495,61 +495,61 @@ _all_aes_cbc_tests() #https://tools.ietf.org/html/draft-mcgrew-gcm-test-01 class _aes128gcm_test_1: - k= "\x4c\x80\xcd\xef\xbb\x5d\x10\xda\x90\x6a\xc7\x3c\x36\x13\xa6\x34" - n= "\x22\x43\x3c\x64\x48\x55\xec\x7d\x3a\x23\x4b\xfd" - p=("\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64\x65\x66\x67\x68" + - "\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x01\x02\x02\x01") - a= "\x00\x00\x43\x21\x87\x65\x43\x21\x00\x00\x00\x07" - ct=("\x74\x75\x2e\x8a\xeb\x5d\x87\x3c\xd7\xc0\xf4\xac\xc3\x6c\x4b\xff" + - "\x84\xb7\xd7\xb9\x8f\x0c\xa8\xb6\xac\xda\x68\x94\xbc\x61\x90\x69" + - "\xef\x9c\xbc\x28\xfe\x1b\x56\xa7\xc4\xe0\xd5\x8c\x86\xcd\x2b\xc0") + k= b"\x4c\x80\xcd\xef\xbb\x5d\x10\xda\x90\x6a\xc7\x3c\x36\x13\xa6\x34" + n= b"\x22\x43\x3c\x64\x48\x55\xec\x7d\x3a\x23\x4b\xfd" + p=(b"\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64\x65\x66\x67\x68" + + b"\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x01\x02\x02\x01") + a= b"\x00\x00\x43\x21\x87\x65\x43\x21\x00\x00\x00\x07" + ct=(b"\x74\x75\x2e\x8a\xeb\x5d\x87\x3c\xd7\xc0\xf4\xac\xc3\x6c\x4b\xff" + + b"\x84\xb7\xd7\xb9\x8f\x0c\xa8\xb6\xac\xda\x68\x94\xbc\x61\x90\x69" + + b"\xef\x9c\xbc\x28\xfe\x1b\x56\xa7\xc4\xe0\xd5\x8c\x86\xcd\x2b\xc0") class _aes128gcm_test_2: - k= "\x3d\xe0\x98\x74\xb3\x88\xe6\x49\x19\x88\xd0\xc3\x60\x7e\xae\x1f" - n= "\x57\x69\x0e\x43\x4e\x28\x00\x00\xa2\xfc\xa1\xa3" - p=("\x45\x00\x00\x30\xda\x3a\x00\x00\x80\x01\xdf\x3b\xc0\xa8\x00\x05" + - "\xc0\xa8\x00\x01\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64" + - "\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" + - "\x01\x02\x02\x01") - a= "\x3f\x7e\xf6\x42\x10\x10\x10\x10\x10\x10\x10\x10" - ct=("\xfb\xa2\xca\xa8\xc6\xc5\xf9\xf0\xf2\x2c\xa5\x4a\x06\x12\x10\xad" + - "\x3f\x6e\x57\x91\xcf\x1a\xca\x21\x0d\x11\x7c\xec\x9c\x35\x79\x17" + - "\x65\xac\xbd\x87\x01\xad\x79\x84\x5b\xf9\xfe\x3f\xba\x48\x7b\xc9" + - "\x63\x21\x93\x06\x84\xee\xca\xdb\x56\x91\x25\x46\xe7\xa9\x5c\x97" + - "\x40\xd7\xcb\x05") + k= b"\x3d\xe0\x98\x74\xb3\x88\xe6\x49\x19\x88\xd0\xc3\x60\x7e\xae\x1f" + n= b"\x57\x69\x0e\x43\x4e\x28\x00\x00\xa2\xfc\xa1\xa3" + p=(b"\x45\x00\x00\x30\xda\x3a\x00\x00\x80\x01\xdf\x3b\xc0\xa8\x00\x05" + + b"\xc0\xa8\x00\x01\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64" + + b"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" + + b"\x01\x02\x02\x01") + a= b"\x3f\x7e\xf6\x42\x10\x10\x10\x10\x10\x10\x10\x10" + ct=(b"\xfb\xa2\xca\xa8\xc6\xc5\xf9\xf0\xf2\x2c\xa5\x4a\x06\x12\x10\xad" + + b"\x3f\x6e\x57\x91\xcf\x1a\xca\x21\x0d\x11\x7c\xec\x9c\x35\x79\x17" + + b"\x65\xac\xbd\x87\x01\xad\x79\x84\x5b\xf9\xfe\x3f\xba\x48\x7b\xc9" + + b"\x63\x21\x93\x06\x84\xee\xca\xdb\x56\x91\x25\x46\xe7\xa9\x5c\x97" + + b"\x40\xd7\xcb\x05") class _aes256gcm_test_1: - k=("\x6c\x65\x67\x61\x6c\x69\x7a\x65\x6d\x61\x72\x69\x6a\x75\x61\x6e" + - "\x61\x61\x6e\x64\x64\x6f\x69\x74\x62\x65\x66\x6f\x72\x65\x69\x61") - n= "\x74\x75\x72\x6e\x33\x30\x21\x69\x67\x65\x74\x6d" - p=("\x45\x00\x00\x30\xda\x3a\x00\x00\x80\x01\xdf\x3b\xc0\xa8\x00\x05" + - "\xc0\xa8\x00\x01\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64" + - "\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" + - "\x01\x02\x02\x01") - a= "\x79\x6b\x69\x63\xff\xff\xff\xff\xff\xff\xff\xff" - ct=("\xf9\x7a\xb2\xaa\x35\x6d\x8e\xdc\xe1\x76\x44\xac\x8c\x78\xe2\x5d" + - "\xd2\x4d\xed\xbb\x29\xeb\xf1\xb6\x4a\x27\x4b\x39\xb4\x9c\x3a\x86" + - "\x4c\xd3\xd7\x8c\xa4\xae\x68\xa3\x2b\x42\x45\x8f\xb5\x7d\xbe\x82" + - "\x1d\xcc\x63\xb9\xd0\x93\x7b\xa2\x94\x5f\x66\x93\x68\x66\x1a\x32" + - "\x9f\xb4\xc0\x53") + k=(b"\x6c\x65\x67\x61\x6c\x69\x7a\x65\x6d\x61\x72\x69\x6a\x75\x61\x6e" + + b"\x61\x61\x6e\x64\x64\x6f\x69\x74\x62\x65\x66\x6f\x72\x65\x69\x61") + n= b"\x74\x75\x72\x6e\x33\x30\x21\x69\x67\x65\x74\x6d" + p=(b"\x45\x00\x00\x30\xda\x3a\x00\x00\x80\x01\xdf\x3b\xc0\xa8\x00\x05" + + b"\xc0\xa8\x00\x01\x08\x00\xc6\xcd\x02\x00\x07\x00\x61\x62\x63\x64" + + b"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" + + b"\x01\x02\x02\x01") + a= b"\x79\x6b\x69\x63\xff\xff\xff\xff\xff\xff\xff\xff" + ct=(b"\xf9\x7a\xb2\xaa\x35\x6d\x8e\xdc\xe1\x76\x44\xac\x8c\x78\xe2\x5d" + + b"\xd2\x4d\xed\xbb\x29\xeb\xf1\xb6\x4a\x27\x4b\x39\xb4\x9c\x3a\x86" + + b"\x4c\xd3\xd7\x8c\xa4\xae\x68\xa3\x2b\x42\x45\x8f\xb5\x7d\xbe\x82" + + b"\x1d\xcc\x63\xb9\xd0\x93\x7b\xa2\x94\x5f\x66\x93\x68\x66\x1a\x32" + + b"\x9f\xb4\xc0\x53") class _aes256gcm_test_2: # this funny plaintext is not our deed - k=("\xab\xbc\xcd\xde\xf0\x01\x12\x23\x34\x45\x56\x67\x78\x89\x9a\xab" + - "\xab\xbc\xcd\xde\xf0\x01\x12\x23\x34\x45\x56\x67\x78\x89\x9a\xab") - n= "\x73\x61\x6c\x74\x61\x6e\x64\x01\x69\x76\x65\x63" - p=("\x63\x69\x73\x63\x6f\x01\x72\x75\x6c\x65\x73\x01\x74\x68\x65\x01" + - "\x6e\x65\x74\x77\x65\x01\x64\x65\x66\x69\x6e\x65\x01\x74\x68\x65" + - "\x74\x65\x63\x68\x6e\x6f\x6c\x6f\x67\x69\x65\x73\x01\x74\x68\x61" + - "\x74\x77\x69\x6c\x6c\x01\x64\x65\x66\x69\x6e\x65\x74\x6f\x6d\x6f" + - "\x72\x72\x6f\x77\x01\x02\x02\x01") - a= "\x17\x40\x5e\x67\x15\x6f\x31\x26\xdd\x0d\xb9\x9b" - ct=("\xd4\xb7\xed\x86\xa1\x77\x7f\x2e\xa1\x3d\x69\x73\xd3\x24\xc6\x9e" + - "\x7b\x43\xf8\x26\xfb\x56\x83\x12\x26\x50\x8b\xeb\xd2\xdc\xeb\x18" + - "\xd0\xa6\xdf\x10\xe5\x48\x7d\xf0\x74\x11\x3e\x14\xc6\x41\x02\x4e" + - "\x3e\x67\x73\xd9\x1a\x62\xee\x42\x9b\x04\x3a\x10\xe3\xef\xe6\xb0" + - "\x12\xa4\x93\x63\x41\x23\x64\xf8\xc0\xca\xc5\x87\xf2\x49\xe5\x6b" + - "\x11\xe2\x4f\x30\xe4\x4c\xcc\x76") + k=(b"\xab\xbc\xcd\xde\xf0\x01\x12\x23\x34\x45\x56\x67\x78\x89\x9a\xab" + + b"\xab\xbc\xcd\xde\xf0\x01\x12\x23\x34\x45\x56\x67\x78\x89\x9a\xab") + n= b"\x73\x61\x6c\x74\x61\x6e\x64\x01\x69\x76\x65\x63" + p=(b"\x63\x69\x73\x63\x6f\x01\x72\x75\x6c\x65\x73\x01\x74\x68\x65\x01" + + b"\x6e\x65\x74\x77\x65\x01\x64\x65\x66\x69\x6e\x65\x01\x74\x68\x65" + + b"\x74\x65\x63\x68\x6e\x6f\x6c\x6f\x67\x69\x65\x73\x01\x74\x68\x61" + + b"\x74\x77\x69\x6c\x6c\x01\x64\x65\x66\x69\x6e\x65\x74\x6f\x6d\x6f" + + b"\x72\x72\x6f\x77\x01\x02\x02\x01") + a= b"\x17\x40\x5e\x67\x15\x6f\x31\x26\xdd\x0d\xb9\x9b" + ct=(b"\xd4\xb7\xed\x86\xa1\x77\x7f\x2e\xa1\x3d\x69\x73\xd3\x24\xc6\x9e" + + b"\x7b\x43\xf8\x26\xfb\x56\x83\x12\x26\x50\x8b\xeb\xd2\xdc\xeb\x18" + + b"\xd0\xa6\xdf\x10\xe5\x48\x7d\xf0\x74\x11\x3e\x14\xc6\x41\x02\x4e" + + b"\x3e\x67\x73\xd9\x1a\x62\xee\x42\x9b\x04\x3a\x10\xe3\xef\xe6\xb0" + + b"\x12\xa4\x93\x63\x41\x23\x64\xf8\xc0\xca\xc5\x87\xf2\x49\xe5\x6b" + + b"\x11\xe2\x4f\x30\xe4\x4c\xcc\x76") def _all_aes_gcm_tests(): from scapy.layers.tls.crypto.cipher_aead import (Cipher_AES_128_GCM, @@ -583,41 +583,41 @@ _all_aes_gcm_tests() #~ combined_modes # #class _aes256ccm_test_1: -# k= "\0"*32 -# n= "\0"*12 -# p= "\0"*16 +# k= b"\0"*32 +# n= b"\0"*12 +# p= b"\0"*16 # a= "" -# ct=("\xc1\x94\x40\x44\xc8\xe7\xaa\x95\xd2\xde\x95\x13\xc7\xf3\xdd\x8c" + -# "\x4b\x0a\x3e\x5e\x51\xf1\x51\xeb\x0f\xfa\xe7\xc4\x3d\x01\x0f\xdb") +# ct=(b"\xc1\x94\x40\x44\xc8\xe7\xaa\x95\xd2\xde\x95\x13\xc7\xf3\xdd\x8c" + +# b"\x4b\x0a\x3e\x5e\x51\xf1\x51\xeb\x0f\xfa\xe7\xc4\x3d\x01\x0f\xdb") # #class _aes256ccm_test_2: -# k=("\xfb\x76\x15\xb2\x3d\x80\x89\x1d\xd4\x70\x98\x0b\xc7\x95\x84\xc8" + -# "\xb2\xfb\x64\xce\x60\x97\x87\x8d\x17\xfc\xe4\x5a\x49\xe8\x30\xb7") -# n= "\xdb\xd1\xa3\x63\x60\x24\xb7\xb4\x02\xda\x7d\x6f" -# p= "\xa9" -# a= "\x36" -# ct="\x9d\x32\x61\xb1\xcf\x93\x14\x31\xe9\x9a\x32\x80\x67\x38\xec\xbd\x2a" +# k=(b"\xfb\x76\x15\xb2\x3d\x80\x89\x1d\xd4\x70\x98\x0b\xc7\x95\x84\xc8" + +# b"\xb2\xfb\x64\xce\x60\x97\x87\x8d\x17\xfc\xe4\x5a\x49\xe8\x30\xb7") +# n= b"\xdb\xd1\xa3\x63\x60\x24\xb7\xb4\x02\xda\x7d\x6f" +# p= b"\xa9" +# a= b"\x36" +# ct=b"\x9d\x32\x61\xb1\xcf\x93\x14\x31\xe9\x9a\x32\x80\x67\x38\xec\xbd\x2a" # #class _aes256ccm_test_3: -# k=("\xfb\x76\x15\xb2\x3d\x80\x89\x1d\xd4\x70\x98\x0b\xc7\x95\x84\xc8" + -# "\xb2\xfb\x64\xce\x60\x97\x8f\x4d\x17\xfc\xe4\x5a\x49\xe8\x30\xb7") -# n= "\xdb\xd1\xa3\x63\x60\x24\xb7\xb4\x02\xda\x7d\x6f" -# p= "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e" +# k=(b"\xfb\x76\x15\xb2\x3d\x80\x89\x1d\xd4\x70\x98\x0b\xc7\x95\x84\xc8" + +# b"\xb2\xfb\x64\xce\x60\x97\x8f\x4d\x17\xfc\xe4\x5a\x49\xe8\x30\xb7") +# n= b"\xdb\xd1\xa3\x63\x60\x24\xb7\xb4\x02\xda\x7d\x6f" +# p= b"\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e" # a= "" -# ct=("\xcc\x88\x12\x61\xc6\xa7\xfa\x72\xb9\x6a\x17\x39\x17\x6b\x27\x7f" + -# "\x34\x72\xe1\x14\x5f\x2c\x0c\xbe\x14\x63\x49\x06\x2c\xf0\xe4\x23") +# ct=(b"\xcc\x88\x12\x61\xc6\xa7\xfa\x72\xb9\x6a\x17\x39\x17\x6b\x27\x7f" + +# b"\x34\x72\xe1\x14\x5f\x2c\x0c\xbe\x14\x63\x49\x06\x2c\xf0\xe4\x23") # #class _aes256ccm_test_4: -# k=("\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" + -# "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f") -# n= "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b" -# p=("\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" + -# "\x30\x31\x32\x33\x34\x35\x36\x37") -# a=("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + -# "\x10\x11\x12\x13") -# ct=("\x04\xf8\x83\xae\xb3\xbd\x07\x30\xea\xf5\x0b\xb6\xde\x4f\xa2\x21" + -# "\x20\x34\xe4\xe4\x1b\x0e\x75\xe5\x9b\xba\x3f\x3a\x10\x7f\x32\x39" + -# "\xbd\x63\x90\x29\x23\xf8\x03\x71") +# k=(b"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" + +# b"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f") +# n= b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b" +# p=(b"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" + +# b"\x30\x31\x32\x33\x34\x35\x36\x37") +# a=(b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + +# b"\x10\x11\x12\x13") +# ct=(b"\x04\xf8\x83\xae\xb3\xbd\x07\x30\xea\xf5\x0b\xb6\xde\x4f\xa2\x21" + +# b"\x20\x34\xe4\xe4\x1b\x0e\x75\xe5\x9b\xba\x3f\x3a\x10\x7f\x32\x39" + +# b"\xbd\x63\x90\x29\x23\xf8\x03\x71") # #def _all_aes_ccm_tests(): # from scapy.layers.tls.crypto.cipher_aead import Cipher_AES_256_CCM @@ -641,17 +641,17 @@ _all_aes_gcm_tests() = Crypto - Camellia cipher, encryption/decryption checks class _Camellia128_test: - k= "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" - p= "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" - c= "\x67\x67\x31\x38\x54\x96\x69\x73\x08\x57\x06\x56\x48\xea\xbe\x43" - iv="\0"*16 + k= b"\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" + p= b"\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" + c= b"\x67\x67\x31\x38\x54\x96\x69\x73\x08\x57\x06\x56\x48\xea\xbe\x43" + iv=b"\0"*16 class _Camellia256_test: - k=("\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" + - "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff") - p= "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" - c= "\x9a\xcc\x23\x7d\xff\x16\xd7\x6c\x20\xef\x7c\x91\x9e\x3a\x75\x09" - iv="\0"*16 + k=(b"\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" + + b"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff") + p= b"\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10" + c= b"\x9a\xcc\x23\x7d\xff\x16\xd7\x6c\x20\xef\x7c\x91\x9e\x3a\x75\x09" + iv=b"\0"*16 def _all_camellia_tests(): from scapy.layers.tls.crypto.cipher_block import (Cipher_CAMELLIA_128_CBC, @@ -679,13 +679,13 @@ _all_camellia_tests() + Test strings = Reading test session - Loading unparsed TLS records -p1_ch = '\x16\x03\x01\x00\xd5\x01\x00\x00\xd1\x03\x03\x17\xf2M\xc3|\x19\xdb\xc3<\xb5J\x0b\x8d5\x81\xc5\xce\t 2\x08\xd8\xec\xd1\xf8"B\x9cW\xd0\x16v\x00\x00\x16\xc0+\xc0/\xc0\n\xc0\t\xc0\x13\xc0\x14\x003\x009\x00/\x005\x00\n\x01\x00\x00\x92\x00\x00\x00\x1f\x00\x1d\x00\x00\x1acamo.githubusercontent.com\xff\x01\x00\x01\x00\x00\n\x00\x08\x00\x06\x00\x17\x00\x18\x00\x19\x00\x0b\x00\x02\x01\x00\x00#\x00\x003t\x00\x00\x00\x10\x00)\x00\'\x05h2-16\x05h2-15\x05h2-14\x02h2\x08spdy/3.1\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\r\x00\x16\x00\x14\x04\x01\x05\x01\x06\x01\x02\x01\x04\x03\x05\x03\x06\x03\x02\x03\x04\x02\x02\x02' -p2_sh = '\x16\x03\x03\x00T\x02\x00\x00P\x03\x03F\x07n\xe2\x0c\x97g\xb7o\xb6\x9b\x14\x19\xbd\xdd1\x80@\xaaQ+\xc2,\x19\x15"\x82\xe8\xc5,\xe8\x12\x00\xc0/\x00\x00(\x00\x00\x00\x00\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00#\x00\x00\x00\x05\x00\x00\x00\x10\x00\x0b\x00\t\x08http/1.1' -p3_cert = '\x16\x03\x03\nu\x0b\x00\nq\x00\nn\x00\x05\xb30\x82\x05\xaf0\x82\x04\x97\xa0\x03\x02\x01\x02\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000p1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1/0-\x06\x03U\x04\x03\x13&DigiCert SHA2 High Assurance Server CA0\x1e\x17\r160120000000Z\x17\r170406120000Z0j1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x130\x11\x06\x03U\x04\x08\x13\nCalifornia1\x160\x14\x06\x03U\x04\x07\x13\rSan Francisco1\x150\x13\x06\x03U\x04\n\x13\x0cFastly, Inc.1\x170\x15\x06\x03U\x04\x03\x13\x0ewww.github.com0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xfb\xd5\x94\n\n\xe0P\xdc\x0f\xfc\x90\xb7qG\x9f,\x05\xde\x0e\x9a\xbc*\x8f\xd4\xf2\x9f\x08F\xf9\xf2\xd1\x18\xb4#\xa5*\xd2\xdf\x91?\xf9\xc5\xd0\xb2@\xbd\xd6\xbc@v.\x8d\xd8\x1e\r7\x8fz\x90W\xef\xe3\xa2\xc0\x11a\x03F\x0e\xfa\xb37\x0bf|!\x16\x8d\xfe/^.Y\xfec\':\xf3\xeds\xf8Mt\xb3Q\x17u\x9a\xed\x0ck\xcd\xe8\xc1\xea\xca\x01\xacu\xf9\x17)\xf0KP\x9dAdHl\xf6\xc0g}\xc8\xea\xdeHy\x81\x97A\x02\xb7F\xf6^M\xa5\xd9\x90\x86\xd7\x1ehQ\xac>%\xae\'\x11\xb1G4\xb8\x8b\xdeoyA\xd6\x92\x13)\x11\x80\xc4\x10\x17\\\x0clj\x02\xbb\xd0\n\xfc\xd2\x96x\x1d\xb6\xd4\x02\x7f\x1f\x0eR@Sop@\xda\x89)O\x0c\t~\xa3\xec\xc5W\xad\x03\xaa\x91\xedC\\\xf9\xf5[\xe8\xa1\xf0\xbem\x1b\xce-\xabC|p\xdc?\xec\xc9\x11\xf0t\xc9)\xa1P\xd0<)8\xdc\x7fV\xb9\xf8\x1f\x04\xa4^\x9f\xce\xdd\x17\x02\x03\x01\x00\x01\xa3\x82\x02I0\x82\x02E0\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14d\xbfD\xb3F\t\x9b\xcfZ\x1dqI\xa2\x04r\x8b\x884\x84#0{\x06\x03U\x1d\x11\x04t0r\x82\x0ewww.github.com\x82\x0c*.github.com\x82\ngithub.com\x82\x0b*.github.io\x82\tgithub.io\x82\x17*.githubusercontent.com\x82\x15githubusercontent.com0\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x05\xa00\x1d\x06\x03U\x1d%\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020u\x06\x03U\x1d\x1f\x04n0l04\xa02\xa00\x86.http://crl3.digicert.com/sha2-ha-server-g5.crl04\xa02\xa00\x86.http://crl4.digicert.com/sha2-ha-server-g5.crl0L\x06\x03U\x1d \x04E0C07\x06\t`\x86H\x01\x86\xfdl\x01\x010*0(\x06\x08+\x06\x01\x05\x05\x07\x02\x01\x16\x1chttps://www.digicert.com/CPS0\x08\x06\x06g\x81\x0c\x01\x02\x020\x81\x83\x06\x08+\x06\x01\x05\x05\x07\x01\x01\x04w0u0$\x06\x08+\x06\x01\x05\x05\x070\x01\x86\x18http://ocsp.digicert.com0M\x06\x08+\x06\x01\x05\x05\x070\x02\x86Ahttp://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00O\x16\xd1t\xf8>\xa3\x8f~\xf7\xaf\xcf\xfa\xb6\xdd\xa7\x88\x9e\xf8!\xad|(\x14\xb9\xb4\xffg\xd0\xb9\xe2O\x81}\x03\xb4\x9d\xbcU\x80$\x8c\xe5fP\xb8\xb8(\xd9\x0f\xb4\x95\xccb\xb2\x87|\xcf\x16^SH\xf9\xc2\xf8\x90 \xdc\x0e\x96\x7f\xe27\xcfA\xc7uf\r\x1c\xa7M\xee\x02\xaa\x1b\x00\xc0\xea\x0e\xd4Df\x08\t\xac\x00\x90pc\xfa\xcd\xaf\x89\x8a\xdbj|z\xb0k\xa8\xc5\xb4\x9d\x85\xd8S\x93E\xcar>\xa4\xd4\xe3\xa28J\x0f\x82\x08\xf0\xf3U\xf0m\xb21l\x189\xbf\xee\xe3\xe5\x8f\xcd@\x07\x0b\xd0\xe9e\xda\xd6LA\xff[\xafB\xaf\xf2\xb1F\xa1\xacX\xfc)\x80\xcb\xf6Z\xa6\xaf\xf26\x93\xdf\x92q\xa95\xe3:XP\xab::|\xd9\xf7y\x83\x9e\t\xfe\x0f\x90,Y+\x07$Z<\xb5\xd2\xa0\xdaE\xb8\xe1\xc0\x03\x07\x00h\xf6L\xfa\xe2v[\xce\x8f\xfe\xd0\xcb%\xf9\x9b\xcb\xa9\xffU\x12\xf3=_En2\xa0$\x8e\xb7\xa5vo\x0b\x87\xe9\x00\x04\xb50\x82\x04\xb10\x82\x03\x99\xa0\x03\x02\x01\x02\x02\x10\x04\xe1\xe7\xa4\xdc\\\xf2\xf3m\xc0+B\xb8]\x15\x9f0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000l1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1+0)\x06\x03U\x04\x03\x13"DigiCert High Assurance EV Root CA0\x1e\x17\r131022120000Z\x17\r281022120000Z0p1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1/0-\x06\x03U\x04\x03\x13&DigiCert SHA2 High Assurance Server CA0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xb6\xe0/\xc2$\x06\xc8m\x04_\xd7\xef\nd\x06\xb2}"&e\x16\xaeB@\x9b\xce\xdc\x9f\x9fv\x07>\xc30U\x87\x19\xb9O\x94\x0eZ\x94\x1fUV\xb4\xc2\x02*\xaf\xd0\x98\xee\x0b@\xd7\xc4\xd0;r\xc8\x14\x9e\xef\x90\xb1\x11\xa9\xae\xd2\xc8\xb8C:\xd9\x0b\x0b\xd5\xd5\x95\xf5@\xaf\xc8\x1d\xedM\x9c_W\xb7\x86Ph\x99\xf5\x8a\xda\xd2\xc7\x05\x1f\xa8\x97\xc9\xdc\xa4\xb1\x82\x84-\xc6\xad\xa5\x9c\xc7\x19\x82\xa6\x85\x0f^DX*7\x8f\xfd5\xf1\x0b\x08\'2Z\xf5\xbb\x8b\x9e\xa4\xbdQ\xd0\'\xe2\xdd;B3\xa3\x05(\xc4\xbb(\xcc\x9a\xac+#\rx\xc6{\xe6^q\xb7J>\x08\xfb\x81\xb7\x16\x16\xa1\x9d#\x12M\xe5\xd7\x92\x08\xacu\xa4\x9c\xba\xcd\x17\xb2\x1eD5e\x7fS%9\xd1\x1c\n\x9ac\x1b\x19\x92th\n7\xc2\xc2RH\xcb9Z\xa2\xb6\xe1]\xc1\xdd\xa0 \xb8!\xa2\x93&o\x14J!A\xc7\xedm\x9b\xf2H/\xf3\x03\xf5\xa2h\x92S/^\xe3\x02\x03\x01\x00\x01\xa3\x82\x01I0\x82\x01E0\x12\x06\x03U\x1d\x13\x01\x01\xff\x04\x080\x06\x01\x01\xff\x02\x01\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x01\x860\x1d\x06\x03U\x1d%\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x0204\x06\x08+\x06\x01\x05\x05\x07\x01\x01\x04(0&0$\x06\x08+\x06\x01\x05\x05\x070\x01\x86\x18http://ocsp.digicert.com0K\x06\x03U\x1d\x1f\x04D0B0@\xa0>\xa0<\x86:http://crl4.digicert.com/DigiCertHighAssuranceEVRootCA.crl0=\x06\x03U\x1d \x0460402\x06\x04U\x1d \x000*0(\x06\x08+\x06\x01\x05\x05\x07\x02\x01\x16\x1chttps://www.digicert.com/CPS0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;0\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14\xb1>\xc3i\x03\xf8\xbfG\x01\xd4\x98&\x1a\x08\x02\xefcd+\xc30\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x18\x8a\x95\x89\x03\xe6m\xdf\\\xfc\x1dh\xeaJ\x8f\x83\xd6Q/\x8dkD\x16\x9e\xacc\xf5\xd2nl\x84\x99\x8b\xaa\x81q\x84[\xed4N\xb0\xb7y\x92)\xcc-\x80j\xf0\x8e \xe1y\xa4\xfe\x03G\x13\xea\xf5\x86\xcaYq}\xf4\x04\x96k\xd3YX=\xfe\xd31%\\\x188\x84\xa3\xe6\x9f\x82\xfd\x8c[\x981N\xcdx\x9e\x1a\xfd\x85\xcbI\xaa\xf2\'\x8b\x99r\xfc>\xaa\xd5A\x0b\xda\xd56\xa1\xbf\x1cnGI\x7f^\xd9H|\x03\xd9\xfd\x8bI\xa0\x98&B@\xeb\xd6\x92\x11\xa4d\nWT\xc4\xf5\x1d\xd6\x02^k\xac\xee\xc4\x80\x9a\x12r\xfaV\x93\xd7\xff\xbf0\x85\x060\xbf\x0b\x7fN\xffW\x05\x9d$\xed\x85\xc3+\xfb\xa6u\xa8\xac-\x16\xef}y\'\xb2\xeb\xc2\x9d\x0b\x07\xea\xaa\x85\xd3\x01\xa3 (AYC(\xd2\x81\xe3\xaa\xf6\xec{;w\xb6@b\x80\x05AE\x01\xef\x17\x06>\xde\xc03\x9bg\xd3a.r\x87\xe4i\xfc\x12\x00W@\x1ep\xf5\x1e\xc9\xb4' -p4_certstat_ske_shd = '\x16\x03\x03\x01\xdf\x16\x00\x01\xdb\x01\x00\x01\xd70\x82\x01\xd3\n\x01\x00\xa0\x82\x01\xcc0\x82\x01\xc8\x06\t+\x06\x01\x05\x05\x070\x01\x01\x04\x82\x01\xb90\x82\x01\xb50\x81\x9e\xa2\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x18\x0f20160914121000Z0s0q0I0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14\xcf&\xf5\x18\xfa\xc9~\x8f\x8c\xb3B\xe0\x1c/j\x10\x9e\x8e_\n\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d\x80\x00\x18\x0f20160914121000Z\xa0\x11\x18\x0f20160921112500Z0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x90\xef\xf9\x15U\x88\xac@l\xf6n\x04C/\x1a\xf5\xbc[Xi\xd9U\xbe\'\xd3\xb7\xf5\xbb\t\xd8\xb1Tw\x9c2\xac\x7f\x88\xba\x98\xe4\xa13\xf4\xdc\xea\xf3\xacX\xe4,E\xf5\xa9\xc3\xf4B-N\xe0\x89D[\xbe\n\xc2h\x9ar\xfd\'.\xc8,\xed\x83\xc2\xf0\x89_\x8c\xc3\xe7\x8a\xad\xa4\x14\x03\x96\x02\xc4\xa8\xc8\x90\x96%X\x80\x95\x02\x9d_\xc82;m\xe9\x15\x00\xa8\x00\xb9\x01\xe3aN&\xe4\xd5\x8a\xc4w7\x0b\xc3~\xc5\xb1M\x10~T\x9e\x1d\xf6\x06\xf8\x12sTg\x14b_\xe7\xc04\xb4\xa3\xd2\x8f\xe6\xa6\xc4\x01q\x03j\xc8\xd4\xc7\x89\xdde\x99\x1a\xd9\x02\xe7\x17\xd1\xf40P\xef\xf6$\xee\xfad\xf4\xeb\xc8\xf7\x0bRL\x8b\xa5x\xe4R2\xe9\xc2\xfcB\nh\x93\xf7\x0ep4h\xeb\x17\x83\xc8\x88!\xc3W\x94WG\xfe3\x15C0qE&A\x99\xa8}\x1a\xda"\xa9O\xba\x90W_W\xado\x1c\xf0`g7\xbb$\x91o\xec\xdd\xbd\x9e\x8bb\xfc\x16\x03\x03\x01M\x0c\x00\x01I\x03\x00\x17A\x04\xc3\x9d\x1cD\xcb\x85?dU\x9eg\xc9\x90\xd8\x80N|F\x98\x0cA\x07\xdfg\xa2\xfb_z\xe4\x9b\xf6\x06\xf3L\x82KJ8\x0e\x1a\x13\x97;:\x12\rdeu\xb5\x9f\x8d\xaa\xfc\x0f\xacb\x0e\xadVX\x19\x03u\x06\x01\x01\x00y\x8aQ\x11\x94\x91\x7f\xf7\xa3#o.\x11\x1d\xb3K\xede~0\xfb\xaf\x92\xfb\xfdY\x98n\x17$\xae\xf6\x16\x14\x13J;\x1cm7\xfa;\xc8G\xa6\x1a}{\xc2\xa5\x1b\xc5\x1c\xb5\x86\x18\x18Z\xa71\x86\x0b-\xa7/q\x89+\xc7$\xbb\xf2 \x17\xc8`\xbbt[j\x9f\x83\x88\xc0\x8d\xcf4fu1\xc3\xea:B\r\xc6\xc9\x12jP\x0c- \x17\x17t\x10\x17)e\xbe\xaao\xe5@\xd2\xcc\xa5\x89mRy\xfapc~\xa6\x84\x80\xbc4\xb4B\xcb\x92\x86\xad\xf6`9j\xf0\x8ee\xc0|\xfd\xdb\xde!\xceH\x0e\x9c\xfb\x85#\x9f\xb7\xccT\x96\xe0 \xfet-\xd8yUs\xe7m\x94\x07\xbc]~\x99\xd3\x93\xfb\\\xfc@B\x14w\xce\xe8n\x14\xd4\xcc\x07\xe5\xb5@j\x17IQ\xcfub\xcf\xa2\xde\xcaU\xb3 \x8b\xdb\x10Y\x0cS\xc7\x0b\xd8BP\xfeX!\x17\x94\x80\xedu\xf8M\xa7r\xc3\x04\xf4\xd6\xb7\x99\xd1=\x922\xf9\x0b\x9f\xe7\x1b\x932`15\xef\x16\x03\x03\x00\x04\x0e\x00\x00\x00' -p5_cke_ccs_fin = "\x16\x03\x03\x00F\x10\x00\x00BA\x04\xd2\x07\xce\xa9v\xd8\x1d\x18\x9bN\xe1\x83U\x8c\x8f\xd5a\x0f\xe5_\x9d\x0f\x8c\x9dT\xf6\xa9\x18'a\x8fHH@\x0c\xd4D\x801\x92\x07\xf3\x95\xa9W\x18\xfc\xb7J\xe6j\xbb\xac\x0f\x86\xae\n+\xd5\xb9\xdc\x86[\xe7\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xcb,\x8cM\xfd\xbc9\xaa\x05\xf3\xd3\xf3Z\x8a-\xc7^\xc1\x8e\x81M\xff\x00\x0f}G\xf2\x8c\xab\n=" -p6_tick_ccs_fin = "\x16\x03\x03\x00\xca\x04\x00\x00\xc6\x00\x00\x04\xb0\x00\xc0c\xccwJ\x00\xdb,B.\x8fv#\xdd\xa9\xaeS\x90S \xb7(^\x0c\xed\n\xaeM\x0bN\xba\xb4\x8a4d\x85\x88 iN\xc9\xd1\xbe\xac\xe2Wb\xc9N\xf3\x85\xbf\xb7j\xa4IB\x8a\x1b\xe4\x8d\x1f\x148%\xd7R3\x0f4\rh\x8f\xccBj\xb5\r\xfa\xc1f\r?f\xc4\x0f_q9\xe1\x07B\x038\xb4}\xbb\xb0\xfc\x0eG\xf2\t&\x13\x98\xcb\xfc\xf6\xf4\xeb\x99!\t]\xe2\xd9-J\xe4\xdbK\xa1\xe5\xf0\t\xdfX\x0c\xb3\r\xf9\x18\xfb}\xd9\nhW1\xfc\x1c\x08DJ,\xa6#\xb0\x15\x16(&\xfdP\x8a%\xeb\xc2\xdd\xd8\xa2/\xbd$\xc3\x14\xfb\xf3\x86\xa3\xceO\x18\x9f\xfdS|'\x11\x02\xc8\xa6eW\xbdo*y\xf3.\xcf\x04\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd8m\x92\t5YZ:7\\)`\xaa`\x7ff\xcd\x10\xa9v\xa3*\x17\x1a\xecguD\xa8\x87$<7+\n\x94\x1e9\x96\xfa" -p7_data = "\x17\x03\x03\x01\xf6\x00\x00\x00\x00\x00\x00\x00\x01?\x04iy\x00\x04 \\\xd0\xd4\x9eG\x1f\xbf\xa3k\xfe=\xee\xce\x15\xa0%%\x06c}\xf6\xd4\xfb\xa6\xf0\xf6\x0cO\x1c\x9c\x91\xa9\x0b\x88J\xe0z\x94\xcaT\xeb\xc7\xad\x02j\x10\r\xc6\x12\xb9\xb9\x7f<\x84V\xab\x1e\xfc\xe5\x01\xda\xd6G\xf5\xb7\xf2I6\x8b\xc9\xc4a\xd3\x19\xeat\xfc\x9b\xfa\x1e\xe7\x8c\xaa\xb3\xce\xd0\x86G\x9b\x90\xf7\xde\xb1\x8bwM\x93\xa2gS>\xf3\x97\xf1CB\xfb\x8fs\x1e\xff\x83\xf9\x8b\xc0]\xbd\x80Mn3\xff\xa9\xf3)'\xc3S\xc8\xcd:\xbe\xd72B~$\xb2;\xeb+\xa4\xbd\xa9A\xd9 \n\x87\xe9\xe2\xe9\x82\x83M\x19Q\xf2n\x0e\x15\xdf\xb3;0\xdd&R\xb7\x15\x89\xe9O\xd8G7\x7f\xc3\xb8f\xc7\xd3\xc90R\x83\xf3\xd4\x1cd\xe8\xc5\x8d\xe4N(k7\xf0\xb7\xbd\x01\xb3\x9b\x86\xbaC.\x17\x8d\xd0g\xc9\xb1\x01\xfa\x01\xbe\xdbt\xb1u/\x19V\xc6\x08@\xff\xa8n\xe8\xd0\xd6n,\x05\xc9\xc2\xd8g\x19\x03.l\xb4)\xa09\xf9\xe7\x83\x01-\xe8\xf8\xffy\xbf\xf7\xe6\x11\xc5\xf5\x9aG\xb3e \xd85\x0f\x8f\x85H\xea\xc2n\x1eR\xbe\x01\xef\xef\x93\xe7*>\xbd\x84\x8b9HDI\x90\xc4$\x9a\x9aK\x88Ki\n\xa3\xab\xed\x91\xcd\xe8\xb1\xd4\x8e\xbcE\x88\xe8\x05\x16\xd5\xed\x18\x16g>\x04\xd8\x1dB}\x91\x90\xd1\xda\x03\xe1\x972CxtD\x85\xafF|~7D9*U\xad\x0b\xc4#\x06}\xec\xd6\xd3?y\x96\xa4\xb5\xa3\x1d\x1c\xbd\xc9\xc9g\xb12\xc9\x0f\xa1\x03\x12N\x0b\xec\x14\xc9vJ\nM\xa7\xc8h\xd0|(1(\xa3\x98@nH\n\x0b\xa80\x00\x02\xb7\x06Z\xd4M\xdc!AV\xe2\xa7*\xc3\x90U\xee\xd0\xb2\x05\xa3w\xe1\xe2\xbe\x1e\xbe\xd4u\xb1\xa1z\x1e\x1c\x15%7\xdd\xf9\xb9~\x02\xf9s\x0c1\xfb;\xab\xf1\x1e\xaf\x06\x8c\xafe\x00\x15e5\xac\xd7]>\x1dLb5\x8e+\x01n\xcb\x19\xcc\x17Ey\xc8" +p1_ch = b'\x16\x03\x01\x00\xd5\x01\x00\x00\xd1\x03\x03\x17\xf2M\xc3|\x19\xdb\xc3<\xb5J\x0b\x8d5\x81\xc5\xce\t 2\x08\xd8\xec\xd1\xf8"B\x9cW\xd0\x16v\x00\x00\x16\xc0+\xc0/\xc0\n\xc0\t\xc0\x13\xc0\x14\x003\x009\x00/\x005\x00\n\x01\x00\x00\x92\x00\x00\x00\x1f\x00\x1d\x00\x00\x1acamo.githubusercontent.com\xff\x01\x00\x01\x00\x00\n\x00\x08\x00\x06\x00\x17\x00\x18\x00\x19\x00\x0b\x00\x02\x01\x00\x00#\x00\x003t\x00\x00\x00\x10\x00)\x00\'\x05h2-16\x05h2-15\x05h2-14\x02h2\x08spdy/3.1\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\r\x00\x16\x00\x14\x04\x01\x05\x01\x06\x01\x02\x01\x04\x03\x05\x03\x06\x03\x02\x03\x04\x02\x02\x02' +p2_sh = b'\x16\x03\x03\x00T\x02\x00\x00P\x03\x03F\x07n\xe2\x0c\x97g\xb7o\xb6\x9b\x14\x19\xbd\xdd1\x80@\xaaQ+\xc2,\x19\x15"\x82\xe8\xc5,\xe8\x12\x00\xc0/\x00\x00(\x00\x00\x00\x00\xff\x01\x00\x01\x00\x00\x0b\x00\x04\x03\x00\x01\x02\x00#\x00\x00\x00\x05\x00\x00\x00\x10\x00\x0b\x00\t\x08http/1.1' +p3_cert = b'\x16\x03\x03\nu\x0b\x00\nq\x00\nn\x00\x05\xb30\x82\x05\xaf0\x82\x04\x97\xa0\x03\x02\x01\x02\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000p1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1/0-\x06\x03U\x04\x03\x13&DigiCert SHA2 High Assurance Server CA0\x1e\x17\r160120000000Z\x17\r170406120000Z0j1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x130\x11\x06\x03U\x04\x08\x13\nCalifornia1\x160\x14\x06\x03U\x04\x07\x13\rSan Francisco1\x150\x13\x06\x03U\x04\n\x13\x0cFastly, Inc.1\x170\x15\x06\x03U\x04\x03\x13\x0ewww.github.com0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xfb\xd5\x94\n\n\xe0P\xdc\x0f\xfc\x90\xb7qG\x9f,\x05\xde\x0e\x9a\xbc*\x8f\xd4\xf2\x9f\x08F\xf9\xf2\xd1\x18\xb4#\xa5*\xd2\xdf\x91?\xf9\xc5\xd0\xb2@\xbd\xd6\xbc@v.\x8d\xd8\x1e\r7\x8fz\x90W\xef\xe3\xa2\xc0\x11a\x03F\x0e\xfa\xb37\x0bf|!\x16\x8d\xfe/^.Y\xfec\':\xf3\xeds\xf8Mt\xb3Q\x17u\x9a\xed\x0ck\xcd\xe8\xc1\xea\xca\x01\xacu\xf9\x17)\xf0KP\x9dAdHl\xf6\xc0g}\xc8\xea\xdeHy\x81\x97A\x02\xb7F\xf6^M\xa5\xd9\x90\x86\xd7\x1ehQ\xac>%\xae\'\x11\xb1G4\xb8\x8b\xdeoyA\xd6\x92\x13)\x11\x80\xc4\x10\x17\\\x0clj\x02\xbb\xd0\n\xfc\xd2\x96x\x1d\xb6\xd4\x02\x7f\x1f\x0eR@Sop@\xda\x89)O\x0c\t~\xa3\xec\xc5W\xad\x03\xaa\x91\xedC\\\xf9\xf5[\xe8\xa1\xf0\xbem\x1b\xce-\xabC|p\xdc?\xec\xc9\x11\xf0t\xc9)\xa1P\xd0<)8\xdc\x7fV\xb9\xf8\x1f\x04\xa4^\x9f\xce\xdd\x17\x02\x03\x01\x00\x01\xa3\x82\x02I0\x82\x02E0\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14d\xbfD\xb3F\t\x9b\xcfZ\x1dqI\xa2\x04r\x8b\x884\x84#0{\x06\x03U\x1d\x11\x04t0r\x82\x0ewww.github.com\x82\x0c*.github.com\x82\ngithub.com\x82\x0b*.github.io\x82\tgithub.io\x82\x17*.githubusercontent.com\x82\x15githubusercontent.com0\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x05\xa00\x1d\x06\x03U\x1d%\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020u\x06\x03U\x1d\x1f\x04n0l04\xa02\xa00\x86.http://crl3.digicert.com/sha2-ha-server-g5.crl04\xa02\xa00\x86.http://crl4.digicert.com/sha2-ha-server-g5.crl0L\x06\x03U\x1d \x04E0C07\x06\t`\x86H\x01\x86\xfdl\x01\x010*0(\x06\x08+\x06\x01\x05\x05\x07\x02\x01\x16\x1chttps://www.digicert.com/CPS0\x08\x06\x06g\x81\x0c\x01\x02\x020\x81\x83\x06\x08+\x06\x01\x05\x05\x07\x01\x01\x04w0u0$\x06\x08+\x06\x01\x05\x05\x070\x01\x86\x18http://ocsp.digicert.com0M\x06\x08+\x06\x01\x05\x05\x070\x02\x86Ahttp://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt0\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00O\x16\xd1t\xf8>\xa3\x8f~\xf7\xaf\xcf\xfa\xb6\xdd\xa7\x88\x9e\xf8!\xad|(\x14\xb9\xb4\xffg\xd0\xb9\xe2O\x81}\x03\xb4\x9d\xbcU\x80$\x8c\xe5fP\xb8\xb8(\xd9\x0f\xb4\x95\xccb\xb2\x87|\xcf\x16^SH\xf9\xc2\xf8\x90 \xdc\x0e\x96\x7f\xe27\xcfA\xc7uf\r\x1c\xa7M\xee\x02\xaa\x1b\x00\xc0\xea\x0e\xd4Df\x08\t\xac\x00\x90pc\xfa\xcd\xaf\x89\x8a\xdbj|z\xb0k\xa8\xc5\xb4\x9d\x85\xd8S\x93E\xcar>\xa4\xd4\xe3\xa28J\x0f\x82\x08\xf0\xf3U\xf0m\xb21l\x189\xbf\xee\xe3\xe5\x8f\xcd@\x07\x0b\xd0\xe9e\xda\xd6LA\xff[\xafB\xaf\xf2\xb1F\xa1\xacX\xfc)\x80\xcb\xf6Z\xa6\xaf\xf26\x93\xdf\x92q\xa95\xe3:XP\xab::|\xd9\xf7y\x83\x9e\t\xfe\x0f\x90,Y+\x07$Z<\xb5\xd2\xa0\xdaE\xb8\xe1\xc0\x03\x07\x00h\xf6L\xfa\xe2v[\xce\x8f\xfe\xd0\xcb%\xf9\x9b\xcb\xa9\xffU\x12\xf3=_En2\xa0$\x8e\xb7\xa5vo\x0b\x87\xe9\x00\x04\xb50\x82\x04\xb10\x82\x03\x99\xa0\x03\x02\x01\x02\x02\x10\x04\xe1\xe7\xa4\xdc\\\xf2\xf3m\xc0+B\xb8]\x15\x9f0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000l1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1+0)\x06\x03U\x04\x03\x13"DigiCert High Assurance EV Root CA0\x1e\x17\r131022120000Z\x17\r281022120000Z0p1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x150\x13\x06\x03U\x04\n\x13\x0cDigiCert Inc1\x190\x17\x06\x03U\x04\x0b\x13\x10www.digicert.com1/0-\x06\x03U\x04\x03\x13&DigiCert SHA2 High Assurance Server CA0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xb6\xe0/\xc2$\x06\xc8m\x04_\xd7\xef\nd\x06\xb2}"&e\x16\xaeB@\x9b\xce\xdc\x9f\x9fv\x07>\xc30U\x87\x19\xb9O\x94\x0eZ\x94\x1fUV\xb4\xc2\x02*\xaf\xd0\x98\xee\x0b@\xd7\xc4\xd0;r\xc8\x14\x9e\xef\x90\xb1\x11\xa9\xae\xd2\xc8\xb8C:\xd9\x0b\x0b\xd5\xd5\x95\xf5@\xaf\xc8\x1d\xedM\x9c_W\xb7\x86Ph\x99\xf5\x8a\xda\xd2\xc7\x05\x1f\xa8\x97\xc9\xdc\xa4\xb1\x82\x84-\xc6\xad\xa5\x9c\xc7\x19\x82\xa6\x85\x0f^DX*7\x8f\xfd5\xf1\x0b\x08\'2Z\xf5\xbb\x8b\x9e\xa4\xbdQ\xd0\'\xe2\xdd;B3\xa3\x05(\xc4\xbb(\xcc\x9a\xac+#\rx\xc6{\xe6^q\xb7J>\x08\xfb\x81\xb7\x16\x16\xa1\x9d#\x12M\xe5\xd7\x92\x08\xacu\xa4\x9c\xba\xcd\x17\xb2\x1eD5e\x7fS%9\xd1\x1c\n\x9ac\x1b\x19\x92th\n7\xc2\xc2RH\xcb9Z\xa2\xb6\xe1]\xc1\xdd\xa0 \xb8!\xa2\x93&o\x14J!A\xc7\xedm\x9b\xf2H/\xf3\x03\xf5\xa2h\x92S/^\xe3\x02\x03\x01\x00\x01\xa3\x82\x01I0\x82\x01E0\x12\x06\x03U\x1d\x13\x01\x01\xff\x04\x080\x06\x01\x01\xff\x02\x01\x000\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x01\x860\x1d\x06\x03U\x1d%\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x0204\x06\x08+\x06\x01\x05\x05\x07\x01\x01\x04(0&0$\x06\x08+\x06\x01\x05\x05\x070\x01\x86\x18http://ocsp.digicert.com0K\x06\x03U\x1d\x1f\x04D0B0@\xa0>\xa0<\x86:http://crl4.digicert.com/DigiCertHighAssuranceEVRootCA.crl0=\x06\x03U\x1d \x0460402\x06\x04U\x1d \x000*0(\x06\x08+\x06\x01\x05\x05\x07\x02\x01\x16\x1chttps://www.digicert.com/CPS0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;0\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14\xb1>\xc3i\x03\xf8\xbfG\x01\xd4\x98&\x1a\x08\x02\xefcd+\xc30\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x18\x8a\x95\x89\x03\xe6m\xdf\\\xfc\x1dh\xeaJ\x8f\x83\xd6Q/\x8dkD\x16\x9e\xacc\xf5\xd2nl\x84\x99\x8b\xaa\x81q\x84[\xed4N\xb0\xb7y\x92)\xcc-\x80j\xf0\x8e \xe1y\xa4\xfe\x03G\x13\xea\xf5\x86\xcaYq}\xf4\x04\x96k\xd3YX=\xfe\xd31%\\\x188\x84\xa3\xe6\x9f\x82\xfd\x8c[\x981N\xcdx\x9e\x1a\xfd\x85\xcbI\xaa\xf2\'\x8b\x99r\xfc>\xaa\xd5A\x0b\xda\xd56\xa1\xbf\x1cnGI\x7f^\xd9H|\x03\xd9\xfd\x8bI\xa0\x98&B@\xeb\xd6\x92\x11\xa4d\nWT\xc4\xf5\x1d\xd6\x02^k\xac\xee\xc4\x80\x9a\x12r\xfaV\x93\xd7\xff\xbf0\x85\x060\xbf\x0b\x7fN\xffW\x05\x9d$\xed\x85\xc3+\xfb\xa6u\xa8\xac-\x16\xef}y\'\xb2\xeb\xc2\x9d\x0b\x07\xea\xaa\x85\xd3\x01\xa3 (AYC(\xd2\x81\xe3\xaa\xf6\xec{;w\xb6@b\x80\x05AE\x01\xef\x17\x06>\xde\xc03\x9bg\xd3a.r\x87\xe4i\xfc\x12\x00W@\x1ep\xf5\x1e\xc9\xb4' +p4_certstat_ske_shd = b'\x16\x03\x03\x01\xdf\x16\x00\x01\xdb\x01\x00\x01\xd70\x82\x01\xd3\n\x01\x00\xa0\x82\x01\xcc0\x82\x01\xc8\x06\t+\x06\x01\x05\x05\x070\x01\x01\x04\x82\x01\xb90\x82\x01\xb50\x81\x9e\xa2\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x18\x0f20160914121000Z0s0q0I0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14\xcf&\xf5\x18\xfa\xc9~\x8f\x8c\xb3B\xe0\x1c/j\x10\x9e\x8e_\n\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d\x80\x00\x18\x0f20160914121000Z\xa0\x11\x18\x0f20160921112500Z0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x90\xef\xf9\x15U\x88\xac@l\xf6n\x04C/\x1a\xf5\xbc[Xi\xd9U\xbe\'\xd3\xb7\xf5\xbb\t\xd8\xb1Tw\x9c2\xac\x7f\x88\xba\x98\xe4\xa13\xf4\xdc\xea\xf3\xacX\xe4,E\xf5\xa9\xc3\xf4B-N\xe0\x89D[\xbe\n\xc2h\x9ar\xfd\'.\xc8,\xed\x83\xc2\xf0\x89_\x8c\xc3\xe7\x8a\xad\xa4\x14\x03\x96\x02\xc4\xa8\xc8\x90\x96%X\x80\x95\x02\x9d_\xc82;m\xe9\x15\x00\xa8\x00\xb9\x01\xe3aN&\xe4\xd5\x8a\xc4w7\x0b\xc3~\xc5\xb1M\x10~T\x9e\x1d\xf6\x06\xf8\x12sTg\x14b_\xe7\xc04\xb4\xa3\xd2\x8f\xe6\xa6\xc4\x01q\x03j\xc8\xd4\xc7\x89\xdde\x99\x1a\xd9\x02\xe7\x17\xd1\xf40P\xef\xf6$\xee\xfad\xf4\xeb\xc8\xf7\x0bRL\x8b\xa5x\xe4R2\xe9\xc2\xfcB\nh\x93\xf7\x0ep4h\xeb\x17\x83\xc8\x88!\xc3W\x94WG\xfe3\x15C0qE&A\x99\xa8}\x1a\xda"\xa9O\xba\x90W_W\xado\x1c\xf0`g7\xbb$\x91o\xec\xdd\xbd\x9e\x8bb\xfc\x16\x03\x03\x01M\x0c\x00\x01I\x03\x00\x17A\x04\xc3\x9d\x1cD\xcb\x85?dU\x9eg\xc9\x90\xd8\x80N|F\x98\x0cA\x07\xdfg\xa2\xfb_z\xe4\x9b\xf6\x06\xf3L\x82KJ8\x0e\x1a\x13\x97;:\x12\rdeu\xb5\x9f\x8d\xaa\xfc\x0f\xacb\x0e\xadVX\x19\x03u\x06\x01\x01\x00y\x8aQ\x11\x94\x91\x7f\xf7\xa3#o.\x11\x1d\xb3K\xede~0\xfb\xaf\x92\xfb\xfdY\x98n\x17$\xae\xf6\x16\x14\x13J;\x1cm7\xfa;\xc8G\xa6\x1a}{\xc2\xa5\x1b\xc5\x1c\xb5\x86\x18\x18Z\xa71\x86\x0b-\xa7/q\x89+\xc7$\xbb\xf2 \x17\xc8`\xbbt[j\x9f\x83\x88\xc0\x8d\xcf4fu1\xc3\xea:B\r\xc6\xc9\x12jP\x0c- \x17\x17t\x10\x17)e\xbe\xaao\xe5@\xd2\xcc\xa5\x89mRy\xfapc~\xa6\x84\x80\xbc4\xb4B\xcb\x92\x86\xad\xf6`9j\xf0\x8ee\xc0|\xfd\xdb\xde!\xceH\x0e\x9c\xfb\x85#\x9f\xb7\xccT\x96\xe0 \xfet-\xd8yUs\xe7m\x94\x07\xbc]~\x99\xd3\x93\xfb\\\xfc@B\x14w\xce\xe8n\x14\xd4\xcc\x07\xe5\xb5@j\x17IQ\xcfub\xcf\xa2\xde\xcaU\xb3 \x8b\xdb\x10Y\x0cS\xc7\x0b\xd8BP\xfeX!\x17\x94\x80\xedu\xf8M\xa7r\xc3\x04\xf4\xd6\xb7\x99\xd1=\x922\xf9\x0b\x9f\xe7\x1b\x932`15\xef\x16\x03\x03\x00\x04\x0e\x00\x00\x00' +p5_cke_ccs_fin = b"\x16\x03\x03\x00F\x10\x00\x00BA\x04\xd2\x07\xce\xa9v\xd8\x1d\x18\x9bN\xe1\x83U\x8c\x8f\xd5a\x0f\xe5_\x9d\x0f\x8c\x9dT\xf6\xa9\x18'a\x8fHH@\x0c\xd4D\x801\x92\x07\xf3\x95\xa9W\x18\xfc\xb7J\xe6j\xbb\xac\x0f\x86\xae\n+\xd5\xb9\xdc\x86[\xe7\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xcb,\x8cM\xfd\xbc9\xaa\x05\xf3\xd3\xf3Z\x8a-\xc7^\xc1\x8e\x81M\xff\x00\x0f}G\xf2\x8c\xab\n=" +p6_tick_ccs_fin = b"\x16\x03\x03\x00\xca\x04\x00\x00\xc6\x00\x00\x04\xb0\x00\xc0c\xccwJ\x00\xdb,B.\x8fv#\xdd\xa9\xaeS\x90S \xb7(^\x0c\xed\n\xaeM\x0bN\xba\xb4\x8a4d\x85\x88 iN\xc9\xd1\xbe\xac\xe2Wb\xc9N\xf3\x85\xbf\xb7j\xa4IB\x8a\x1b\xe4\x8d\x1f\x148%\xd7R3\x0f4\rh\x8f\xccBj\xb5\r\xfa\xc1f\r?f\xc4\x0f_q9\xe1\x07B\x038\xb4}\xbb\xb0\xfc\x0eG\xf2\t&\x13\x98\xcb\xfc\xf6\xf4\xeb\x99!\t]\xe2\xd9-J\xe4\xdbK\xa1\xe5\xf0\t\xdfX\x0c\xb3\r\xf9\x18\xfb}\xd9\nhW1\xfc\x1c\x08DJ,\xa6#\xb0\x15\x16(&\xfdP\x8a%\xeb\xc2\xdd\xd8\xa2/\xbd$\xc3\x14\xfb\xf3\x86\xa3\xceO\x18\x9f\xfdS|'\x11\x02\xc8\xa6eW\xbdo*y\xf3.\xcf\x04\x14\x03\x03\x00\x01\x01\x16\x03\x03\x00(\xd8m\x92\t5YZ:7\\)`\xaa`\x7ff\xcd\x10\xa9v\xa3*\x17\x1a\xecguD\xa8\x87$<7+\n\x94\x1e9\x96\xfa" +p7_data = b"\x17\x03\x03\x01\xf6\x00\x00\x00\x00\x00\x00\x00\x01?\x04iy\x00\x04 \\\xd0\xd4\x9eG\x1f\xbf\xa3k\xfe=\xee\xce\x15\xa0%%\x06c}\xf6\xd4\xfb\xa6\xf0\xf6\x0cO\x1c\x9c\x91\xa9\x0b\x88J\xe0z\x94\xcaT\xeb\xc7\xad\x02j\x10\r\xc6\x12\xb9\xb9\x7f<\x84V\xab\x1e\xfc\xe5\x01\xda\xd6G\xf5\xb7\xf2I6\x8b\xc9\xc4a\xd3\x19\xeat\xfc\x9b\xfa\x1e\xe7\x8c\xaa\xb3\xce\xd0\x86G\x9b\x90\xf7\xde\xb1\x8bwM\x93\xa2gS>\xf3\x97\xf1CB\xfb\x8fs\x1e\xff\x83\xf9\x8b\xc0]\xbd\x80Mn3\xff\xa9\xf3)'\xc3S\xc8\xcd:\xbe\xd72B~$\xb2;\xeb+\xa4\xbd\xa9A\xd9 \n\x87\xe9\xe2\xe9\x82\x83M\x19Q\xf2n\x0e\x15\xdf\xb3;0\xdd&R\xb7\x15\x89\xe9O\xd8G7\x7f\xc3\xb8f\xc7\xd3\xc90R\x83\xf3\xd4\x1cd\xe8\xc5\x8d\xe4N(k7\xf0\xb7\xbd\x01\xb3\x9b\x86\xbaC.\x17\x8d\xd0g\xc9\xb1\x01\xfa\x01\xbe\xdbt\xb1u/\x19V\xc6\x08@\xff\xa8n\xe8\xd0\xd6n,\x05\xc9\xc2\xd8g\x19\x03.l\xb4)\xa09\xf9\xe7\x83\x01-\xe8\xf8\xffy\xbf\xf7\xe6\x11\xc5\xf5\x9aG\xb3e \xd85\x0f\x8f\x85H\xea\xc2n\x1eR\xbe\x01\xef\xef\x93\xe7*>\xbd\x84\x8b9HDI\x90\xc4$\x9a\x9aK\x88Ki\n\xa3\xab\xed\x91\xcd\xe8\xb1\xd4\x8e\xbcE\x88\xe8\x05\x16\xd5\xed\x18\x16g>\x04\xd8\x1dB}\x91\x90\xd1\xda\x03\xe1\x972CxtD\x85\xafF|~7D9*U\xad\x0b\xc4#\x06}\xec\xd6\xd3?y\x96\xa4\xb5\xa3\x1d\x1c\xbd\xc9\xc9g\xb12\xc9\x0f\xa1\x03\x12N\x0b\xec\x14\xc9vJ\nM\xa7\xc8h\xd0|(1(\xa3\x98@nH\n\x0b\xa80\x00\x02\xb7\x06Z\xd4M\xdc!AV\xe2\xa7*\xc3\x90U\xee\xd0\xb2\x05\xa3w\xe1\xe2\xbe\x1e\xbe\xd4u\xb1\xa1z\x1e\x1c\x15%7\xdd\xf9\xb9~\x02\xf9s\x0c1\xfb;\xab\xf1\x1e\xaf\x06\x8c\xafe\x00\x15e5\xac\xd7]>\x1dLb5\x8e+\x01n\xcb\x19\xcc\x17Ey\xc8" + Test TLS @@ -722,7 +722,7 @@ assert(ch.msgtype == 1) assert(ch.msglen == 209) assert(ch.version == 0x0303) assert(ch.gmt_unix_time == 0x17f24dc3) -assert(ch.random_bytes == '|\x19\xdb\xc3<\xb5J\x0b\x8d5\x81\xc5\xce\t 2\x08\xd8\xec\xd1\xf8"B\x9cW\xd0\x16v') +assert(ch.random_bytes == b'|\x19\xdb\xc3<\xb5J\x0b\x8d5\x81\xc5\xce\t 2\x08\xd8\xec\xd1\xf8"B\x9cW\xd0\x16v') assert(ch.sidlen == 0) assert(not ch.sid) assert(ch.cipherslen == 22) @@ -770,7 +770,7 @@ assert(TLSServerHello in t2) sh = t2.msg[0] assert(isinstance(sh, TLSServerHello)) assert(sh.gmt_unix_time == 0x46076ee2) -assert(sh.random_bytes == '\x0c\x97g\xb7o\xb6\x9b\x14\x19\xbd\xdd1\x80@\xaaQ+\xc2,\x19\x15"\x82\xe8\xc5,\xe8\x12') +assert(sh.random_bytes == b'\x0c\x97g\xb7o\xb6\x9b\x14\x19\xbd\xdd1\x80@\xaaQ+\xc2,\x19\x15"\x82\xe8\xc5,\xe8\x12') assert(sh.cipher == 0xc02f) assert(len(sh.ext) == 6) sh.ext[-1].protocols[-1].protocol == "http/1.1" @@ -809,9 +809,9 @@ assert(isinstance(ske, TLSServerKeyExchange)) p = ske.params assert(isinstance(p, ServerECDHNamedCurveParams)) assert(p.named_curve == 0x0017) -assert(p.point[0] == '\x04' and p.point[1:5] == '\xc3\x9d\x1cD' and p.point[-4:] == 'X\x19\x03u') +assert(p.point[0] == b'\x04' and p.point[1:5] == b'\xc3\x9d\x1cD' and p.point[-4:] == b'X\x19\x03u') assert(ske.sig.sig_alg == 0x0601) -ske.sig.sig_val[:4] == 'y\x8aQ\x11' and ske.sig.sig_val[-4:] == '`15\xef' +ske.sig.sig_val[:4] == b'y\x8aQ\x11' and ske.sig.sig_val[-4:] == b'`15\xef' + Test TLS ServerHelloDone @@ -830,7 +830,7 @@ assert(t.client_kx_ecdh_params is not None) pn = t.server_kx_pubkey.public_numbers() x = pkcs_i2osp(pn.x, pn.curve.key_size/8) y = pkcs_i2osp(pn.y, pn.curve.key_size/8) -assert(x[:4] == '\xc3\x9d\x1cD' and y[-4:] == 'X\x19\x03u') +assert(x[:4] == b'\xc3\x9d\x1cD' and y[-4:] == b'X\x19\x03u') assert(t.rcs.row == "read") assert(t.wcs.row == "write") t.rcs.ciphersuite.val == 0 @@ -854,7 +854,7 @@ assert(isinstance(cke, TLSClientKeyExchange)) k = cke.exchkeys assert(isinstance(k, ClientECDiffieHellmanPublic)) assert(k.ecdh_Yclen == 65) -assert(k.ecdh_Yc[:4] == '\x04\xd2\x07\xce' and k.ecdh_Yc[-4:] == '\xdc\x86[\xe7') +assert(k.ecdh_Yc[:4] == b'\x04\xd2\x07\xce' and k.ecdh_Yc[-4:] == b'\xdc\x86[\xe7') + Test TLS ChangeCipherSpec @@ -867,12 +867,12 @@ ccs.msgtype == 1 = Reading test session - Finished assert(rec_fin.version == 0x0303) assert(rec_fin.len == 16) -assert(rec_fin.iv == '\x00\x00\x00\x00\x00\x00\x00\x00') -assert(rec_fin.mac == '\xc7^\xc1\x8e\x81M\xff\x00\x0f}G\xf2\x8c\xab\n=') +assert(rec_fin.iv == b'\x00\x00\x00\x00\x00\x00\x00\x00') +assert(rec_fin.mac == b'\xc7^\xc1\x8e\x81M\xff\x00\x0f}G\xf2\x8c\xab\n=') assert(not rec_fin.pad and not rec_fin.padlen) from scapy.layers.tls.record import _TLSEncryptedContent assert(isinstance(fin, _TLSEncryptedContent)) -fin.load == '\xd9\xcb,\x8cM\xfd\xbc9\xaa\x05\xf3\xd3\xf3Z\x8a-' +fin.load == b'\xd9\xcb,\x8cM\xfd\xbc9\xaa\x05\xf3\xd3\xf3Z\x8a-' + Test TLS Tick-CCS-Fin @@ -883,21 +883,21 @@ assert(isinstance(tick, TLSNewSessionTicket)) assert(tick.msgtype == 4) assert(tick.lifetime == 1200) assert(tick.ticketlen == 192) -assert(tick.ticket[:4] == 'c\xccwJ' and tick.ticket[-4:] == '\xf3.\xcf\x04') +assert(tick.ticket[:4] == b'c\xccwJ' and tick.ticket[-4:] == b'\xf3.\xcf\x04') ccs = t6.payload.msg[0] assert(isinstance(ccs, TLSChangeCipherSpec)) rec_fin = TLS(str(t6.payload.payload), tls_session=t1.tls_session) -assert(rec_fin.iv == '\xd8m\x92\t5YZ:') -assert(rec_fin.mac == '\xecguD\xa8\x87$<7+\n\x94\x1e9\x96\xfa') +assert(rec_fin.iv == b'\xd8m\x92\t5YZ:') +assert(rec_fin.mac == b'\xecguD\xa8\x87$<7+\n\x94\x1e9\x96\xfa') assert(isinstance(rec_fin.msg[0], _TLSEncryptedContent)) -rec_fin.msg[0].load == '7\\)`\xaa`\x7ff\xcd\x10\xa9v\xa3*\x17\x1a' +rec_fin.msg[0].load == b'7\\)`\xaa`\x7ff\xcd\x10\xa9v\xa3*\x17\x1a' + Test TLS ApplicationData = Reading test session - ApplicationData t7 = TLS(p7_data, tls_session=t1.tls_session) -assert(t7.iv == '\x00\x00\x00\x00\x00\x00\x00\x01') -assert(t7.mac == '>\x1dLb5\x8e+\x01n\xcb\x19\xcc\x17Ey\xc8') +assert(t7.iv == b'\x00\x00\x00\x00\x00\x00\x00\x01') +assert(t7.mac == b'>\x1dLb5\x8e+\x01n\xcb\x19\xcc\x17Ey\xc8') assert(not t7.pad and not t7.padlen) assert(isinstance(t7.msg[0], _TLSEncryptedContent)) len(t7.msg[0].load) == 478 @@ -926,7 +926,7 @@ ch = TLSClientHello() ch.msgtype = 'client_hello' ch.version = 'TLS 1.2' ch.gmt_unix_time = 0x26ee2ddd -ch.random_bytes = 'X\xe1\xb1T\xaa\xb1\x0b\xa0zlg\xf8\xd14]%\xa9\x91d\x08\xc7t\xcd6\xd4"\x9f\xcf' +ch.random_bytes = b'X\xe1\xb1T\xaa\xb1\x0b\xa0zlg\xf8\xd14]%\xa9\x91d\x08\xc7t\xcd6\xd4"\x9f\xcf' ch.ciphers = [TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA] ch.comp = 'null' ext1 = TLS_Ext_ServerName(servernames=ServerName(servername='mn.scapy.wtv')) @@ -940,7 +940,7 @@ ext8 = TLS_Ext_CSR(stype='ocsp', req=OCSPStatusRequest()) ext9 = TLS_Ext_SignatureAlgorithms(sig_algs=['sha256+rsa', 'sha384+rsa', 'sha512+rsa', 'sha1+rsa', 'sha256+ecdsa', 'sha384+ecdsa', 'sha512+ecdsa', 'sha1+ecdsa', 'sha256+dsa', 'sha1+dsa']) ch.ext = [ext1, ext2, ext3, ext4, ext5, ext6, ext7, ext8, ext9] t = TLS(type='handshake', version='TLS 1.0', msg=ch) -str(t) == '\x16\x03\x01\x00\xc7\x01\x00\x00\xc3\x03\x03&\xee-\xddX\xe1\xb1T\xaa\xb1\x0b\xa0zlg\xf8\xd14]%\xa9\x91d\x08\xc7t\xcd6\xd4"\x9f\xcf\x00\x00\x16\xc0+\xc0/\xc0\n\xc0\t\xc0\x13\xc0\x14\x003\x009\x00/\x005\x00\n\x01\x00\x00\x84\x00\x00\x00\x11\x00\x0f\x00\x00\x0cmn.scapy.wtv\xff\x01\x00\x01\x00\x00\n\x00\x08\x00\x06\x00\x17\x00\x18\x00\x19\x00\x0b\x00\x02\x01\x00\x00#\x00\x003t\x00\x00\x00\x10\x00)\x00\'\x05h2-16\x05h2-15\x05h2-14\x02h2\x08spdy/3.1\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\r\x00\x16\x00\x14\x04\x01\x05\x01\x06\x01\x02\x01\x04\x03\x05\x03\x06\x03\x02\x03\x04\x02\x02\x02' +str(t) == b'\x16\x03\x01\x00\xc7\x01\x00\x00\xc3\x03\x03&\xee-\xddX\xe1\xb1T\xaa\xb1\x0b\xa0zlg\xf8\xd14]%\xa9\x91d\x08\xc7t\xcd6\xd4"\x9f\xcf\x00\x00\x16\xc0+\xc0/\xc0\n\xc0\t\xc0\x13\xc0\x14\x003\x009\x00/\x005\x00\n\x01\x00\x00\x84\x00\x00\x00\x11\x00\x0f\x00\x00\x0cmn.scapy.wtv\xff\x01\x00\x01\x00\x00\n\x00\x08\x00\x06\x00\x17\x00\x18\x00\x19\x00\x0b\x00\x02\x01\x00\x00#\x00\x003t\x00\x00\x00\x10\x00)\x00\'\x05h2-16\x05h2-15\x05h2-14\x02h2\x08spdy/3.1\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\r\x00\x16\x00\x14\x04\x01\x05\x01\x06\x01\x02\x01\x04\x03\x05\x03\x06\x03\x02\x03\x04\x02\x02\x02' + Test Build TLS ServerKeyExchange @@ -960,13 +960,13 @@ t.tls_session.server_random == 'A'*4+'B'*28 + Test Build TLS wrong record = Building packets - ChangeCipherSpec with forged, forbidden field values t = TLS(msg=TLSChangeCipherSpec()) -assert(str(t) == '\x14\x03\x03\x00\x01\x01') +assert(str(t) == b'\x14\x03\x03\x00\x01\x01') t.len = 0 -assert(str(t) == '\x14\x03\x03\x00\x00\x01') +assert(str(t) == b'\x14\x03\x03\x00\x00\x01') t.type = 0xde t.version = 0xadbe t.len = 0xefff -str(t) == '\xde\xad\xbe\xef\xff\x01' +str(t) == b'\xde\xad\xbe\xef\xff\x01' ############################################################################### diff --git a/test/x509.uts b/test/x509.uts index d910c3e003fbbc759330ce6c5f82cb38ad147fd8..1b3efbd0443a109c2a362b3d96a842047453d80c 100644 --- a/test/x509.uts +++ b/test/x509.uts @@ -7,7 +7,7 @@ + General BER decoding tests = Decoding an ASN.1 SEQUENCE with an unknown, high-tag identifier -s = '\xff\x84\x92\xb9\x86H\x1e0\x1c\x16\x04BNCH\x04\x14\xb7\xca\x01wO\x9b\xbaz\xbb\xb5\x92\x87>T\xb2\xc3g\xc1]\xfb' +s = b'\xff\x84\x92\xb9\x86H\x1e0\x1c\x16\x04BNCH\x04\x14\xb7\xca\x01wO\x9b\xbaz\xbb\xb5\x92\x87>T\xb2\xc3g\xc1]\xfb' p = ASN1P_PRIVSEQ(s) @@ -117,14 +117,14 @@ ext[0].extnID == ASN1_OID("subjectKeyIdentifier") and ext[0].critical == None = Cert class : Subject key identifier extension value assert(type(ext[0].extnValue) is X509_ExtSubjectKeyIdentifier) -ext[0].extnValue.keyIdentifier == ASN1_STRING('\xf3\xd8N\xde\x90\xf7\xe6]\xd2\xce3\xcd\\V\x8co\x97\x141K') +ext[0].extnValue.keyIdentifier == ASN1_STRING(b'\xf3\xd8N\xde\x90\xf7\xe6]\xd2\xce3\xcd\\V\x8co\x97\x141K') = Cert class : Signature algorithm assert(type(x.signatureAlgorithm) is X509_AlgorithmIdentifier) x.signatureAlgorithm.algorithm == ASN1_OID("sha1_with_rsa_signature") = Cert class : Signature value -x.signatureValue == ASN1_BIT_STRING("6\xce\xdd\x01\xbdz\x1f\x89[\xc71i_\xb5\x90\xac\xb5\x06\x9a\xc1\xe8\xf5Jlk\x01\xf0\xc1\xe0\xd5\x0c\xdb\x83l\x1b\xe5\x19#\xcf\x17\x03\x95\xcc\xe9\n%\x99\xfc\x8a\x9c\xda\xe8\x98\xc2\xc2\xd7\xee\x82h\\c\xabx\xc2\xfe\xa7R\xee'\xda\x94R\xd0V\x8e\xe2\x93\xfb^\xd3>\x8e\x96\x8d\x11\x90\x13`\xc9\xa8\x16=}\x8bG\x99\x07{\xd4oH;\xa8<\x8b\x1bHs&$\x0f|\x01\x9c\x1a\xb5\xbb\xc4\x86l\xcc \xd2MR\x81\xd5\xce\x13\xde\x1d\x99\xc8h\x18\x14\x06\r6]B\xe4\xfcIbt\xeeuE\xfd\xe0\x87\xc7Q\xfeH\x05A$\x13\xeb\xce\xef\xb3\\}M`\xf4\xd3=\x10\xd9\xbb6P]\xceo\x7f\x8dbA\x06\x12\x8eE\xf5\x17\x8fBm&c\xde\x02Oll\xe9jG\xa3N\xb4\x16\x8e\xdfV\x90\x05\x92\xd3\x16\xc7[\xe9\xbb\xec,\x11\xb4\x00\x86\x01\xaaWG\xc2Gd0(2\x1bN\xb3\xd6\xfe\x9fG&\xd2CaX\xd8t\x01q\xaf{;W\xbe\xf2", readable=True) +x.signatureValue == ASN1_BIT_STRING(b"6\xce\xdd\x01\xbdz\x1f\x89[\xc71i_\xb5\x90\xac\xb5\x06\x9a\xc1\xe8\xf5Jlk\x01\xf0\xc1\xe0\xd5\x0c\xdb\x83l\x1b\xe5\x19#\xcf\x17\x03\x95\xcc\xe9\n%\x99\xfc\x8a\x9c\xda\xe8\x98\xc2\xc2\xd7\xee\x82h\\c\xabx\xc2\xfe\xa7R\xee'\xda\x94R\xd0V\x8e\xe2\x93\xfb^\xd3>\x8e\x96\x8d\x11\x90\x13`\xc9\xa8\x16=}\x8bG\x99\x07{\xd4oH;\xa8<\x8b\x1bHs&$\x0f|\x01\x9c\x1a\xb5\xbb\xc4\x86l\xcc \xd2MR\x81\xd5\xce\x13\xde\x1d\x99\xc8h\x18\x14\x06\r6]B\xe4\xfcIbt\xeeuE\xfd\xe0\x87\xc7Q\xfeH\x05A$\x13\xeb\xce\xef\xb3\\}M`\xf4\xd3=\x10\xd9\xbb6P]\xceo\x7f\x8dbA\x06\x12\x8eE\xf5\x17\x8fBm&c\xde\x02Oll\xe9jG\xa3N\xb4\x16\x8e\xdfV\x90\x05\x92\xd3\x16\xc7[\xe9\xbb\xec,\x11\xb4\x00\x86\x01\xaaWG\xc2Gd0(2\x1bN\xb3\xd6\xfe\x9fG&\xd2CaX\xd8t\x01q\xaf{;W\xbe\xf2", readable=True) = Cert class : Default X509_Cert from scratch str(X509_Cert(str(X509_Cert()))) == str(X509_Cert()) @@ -183,7 +183,7 @@ assert(type(x.signatureAlgorithm) is X509_AlgorithmIdentifier) x.signatureAlgorithm.algorithm == ASN1_OID("sha1_with_rsa_signature") = CRL class : Signature value -x.signatureValue == ASN1_BIT_STRING('"\xc9\xf6\xbb\x1d\xa1\xa5=$\xc7\xff\xb0"\x11\xb3p\x06[\xc5U\xdd3v\xa0\x98"\x08cDi\xcfOG%w\x99\x12\x84\xd2\x19\xae \x94\xca,T\x9ak\x81\xd2\x038\xa6Z\x95\x8d*\xe2a\xce\xdb\x19\xcdu\'Y&|V\xe1\xe4\x80q\x1aI\xb2\xaa\xcdI[\xda\x0f\xa8\xff\xce<\n\xfc\xc9\xad\xc6\xde\xc8@d\x0c&\t#\x90\xb7\x9c\xb9P\x03\x8fK\x18\x9f\xb0\xe0e\x0f`\x1c\x1ag\xe5\x85\xc4%\xf5\x0b\xc93\x82R\xe6', readable=True) +x.signatureValue == ASN1_BIT_STRING(b'"\xc9\xf6\xbb\x1d\xa1\xa5=$\xc7\xff\xb0"\x11\xb3p\x06[\xc5U\xdd3v\xa0\x98"\x08cDi\xcfOG%w\x99\x12\x84\xd2\x19\xae \x94\xca,T\x9ak\x81\xd2\x038\xa6Z\x95\x8d*\xe2a\xce\xdb\x19\xcdu\'Y&|V\xe1\xe4\x80q\x1aI\xb2\xaa\xcdI[\xda\x0f\xa8\xff\xce<\n\xfc\xc9\xad\xc6\xde\xc8@d\x0c&\t#\x90\xb7\x9c\xb9P\x03\x8fK\x18\x9f\xb0\xe0e\x0f`\x1c\x1ag\xe5\x85\xc4%\xf5\x0b\xc93\x82R\xe6', readable=True) = CRL class : Default X509_CRL from scratch s = str(X509_CRL()) @@ -208,7 +208,7 @@ str(r.type_id) == '171.184.10.271' ############ OCSP class ############################################### = OCSP class : OCSP Response import -s = '0\x82\x01\xd3\n\x01\x00\xa0\x82\x01\xcc0\x82\x01\xc8\x06\t+\x06\x01\x05\x05\x070\x01\x01\x04\x82\x01\xb90\x82\x01\xb50\x81\x9e\xa2\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x18\x0f20160914121000Z0s0q0I0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14\xcf&\xf5\x18\xfa\xc9~\x8f\x8c\xb3B\xe0\x1c/j\x10\x9e\x8e_\n\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d\x80\x00\x18\x0f20160914121000Z\xa0\x11\x18\x0f20160921112500Z0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x90\xef\xf9\x15U\x88\xac@l\xf6n\x04C/\x1a\xf5\xbc[Xi\xd9U\xbe\'\xd3\xb7\xf5\xbb\t\xd8\xb1Tw\x9c2\xac\x7f\x88\xba\x98\xe4\xa13\xf4\xdc\xea\xf3\xacX\xe4,E\xf5\xa9\xc3\xf4B-N\xe0\x89D[\xbe\n\xc2h\x9ar\xfd\'.\xc8,\xed\x83\xc2\xf0\x89_\x8c\xc3\xe7\x8a\xad\xa4\x14\x03\x96\x02\xc4\xa8\xc8\x90\x96%X\x80\x95\x02\x9d_\xc82;m\xe9\x15\x00\xa8\x00\xb9\x01\xe3aN&\xe4\xd5\x8a\xc4w7\x0b\xc3~\xc5\xb1M\x10~T\x9e\x1d\xf6\x06\xf8\x12sTg\x14b_\xe7\xc04\xb4\xa3\xd2\x8f\xe6\xa6\xc4\x01q\x03j\xc8\xd4\xc7\x89\xdde\x99\x1a\xd9\x02\xe7\x17\xd1\xf40P\xef\xf6$\xee\xfad\xf4\xeb\xc8\xf7\x0bRL\x8b\xa5x\xe4R2\xe9\xc2\xfcB\nh\x93\xf7\x0ep4h\xeb\x17\x83\xc8\x88!\xc3W\x94WG\xfe3\x15C0qE&A\x99\xa8}\x1a\xda"\xa9O\xba\x90W_W\xado\x1c\xf0`g7\xbb$\x91o\xec\xdd\xbd\x9e\x8bb\xfc' +s = b'0\x82\x01\xd3\n\x01\x00\xa0\x82\x01\xcc0\x82\x01\xc8\x06\t+\x06\x01\x05\x05\x070\x01\x01\x04\x82\x01\xb90\x82\x01\xb50\x81\x9e\xa2\x16\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x18\x0f20160914121000Z0s0q0I0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14\xcf&\xf5\x18\xfa\xc9~\x8f\x8c\xb3B\xe0\x1c/j\x10\x9e\x8e_\n\x04\x14Qh\xff\x90\xaf\x02\x07u<\xcc\xd9edb\xa2\x12\xb8Yr;\x02\x10\x07z]\xc36#\x01\xf9\x89\xfeT\xf7\xf8o>d\x80\x00\x18\x0f20160914121000Z\xa0\x11\x18\x0f20160921112500Z0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x00\x03\x82\x01\x01\x00\x90\xef\xf9\x15U\x88\xac@l\xf6n\x04C/\x1a\xf5\xbc[Xi\xd9U\xbe\'\xd3\xb7\xf5\xbb\t\xd8\xb1Tw\x9c2\xac\x7f\x88\xba\x98\xe4\xa13\xf4\xdc\xea\xf3\xacX\xe4,E\xf5\xa9\xc3\xf4B-N\xe0\x89D[\xbe\n\xc2h\x9ar\xfd\'.\xc8,\xed\x83\xc2\xf0\x89_\x8c\xc3\xe7\x8a\xad\xa4\x14\x03\x96\x02\xc4\xa8\xc8\x90\x96%X\x80\x95\x02\x9d_\xc82;m\xe9\x15\x00\xa8\x00\xb9\x01\xe3aN&\xe4\xd5\x8a\xc4w7\x0b\xc3~\xc5\xb1M\x10~T\x9e\x1d\xf6\x06\xf8\x12sTg\x14b_\xe7\xc04\xb4\xa3\xd2\x8f\xe6\xa6\xc4\x01q\x03j\xc8\xd4\xc7\x89\xdde\x99\x1a\xd9\x02\xe7\x17\xd1\xf40P\xef\xf6$\xee\xfad\xf4\xeb\xc8\xf7\x0bRL\x8b\xa5x\xe4R2\xe9\xc2\xfcB\nh\x93\xf7\x0ep4h\xeb\x17\x83\xc8\x88!\xc3W\x94WG\xfe3\x15C0qE&A\x99\xa8}\x1a\xda"\xa9O\xba\x90W_W\xado\x1c\xf0`g7\xbb$\x91o\xec\xdd\xbd\x9e\x8bb\xfc' response = OCSP_Response(s) = OCSP class : OCSP Response global checks @@ -218,7 +218,7 @@ responseBytes = response.responseBytes assert(responseBytes.responseType == ASN1_OID("basic_response")) assert(responseBytes.signatureAlgorithm.algorithm == ASN1_OID("sha256WithRSAEncryption")) assert(responseBytes.signatureAlgorithm.parameters == ASN1_NULL(0)) -assert(responseBytes.signature.val_readable[:3] == "\x90\xef\xf9" and responseBytes.signature.val_readable[-3:] == "\x8bb\xfc") +assert(responseBytes.signature.val_readable[:3] == b"\x90\xef\xf9" and responseBytes.signature.val_readable[-3:] == b"\x8bb\xfc") responseBytes.certs is None = OCSP class : OCSP ResponseData checks @@ -226,7 +226,7 @@ responseData = responseBytes.tbsResponseData assert(responseData.version is None) rID = responseData.responderID.responderID assert(isinstance(rID, OCSP_ByKey)) -assert(rID.byKey.val[:3] == "Qh\xff" and rID.byKey.val[-3:] == "Yr;") +assert(rID.byKey.val[:3] == b"Qh\xff" and rID.byKey.val[-3:] == "Yr;") assert(responseData.producedAt == ASN1_GENERALIZED_TIME("20160914121000Z")) assert(len(responseData.responses) == 1) responseData.responseExtensions is None @@ -235,8 +235,8 @@ responseData.responseExtensions is None singleResponse = responseData.responses[0] assert(singleResponse.certID.hashAlgorithm.algorithm == ASN1_OID("sha1")) assert(singleResponse.certID.hashAlgorithm.parameters == ASN1_NULL(0)) -assert(singleResponse.certID.issuerNameHash.val[:3] == "\xcf&\xf5" and singleResponse.certID.issuerNameHash.val[-3:] == "\x8e_\n") -assert(singleResponse.certID.issuerKeyHash.val[:3] == "Qh\xff" and singleResponse.certID.issuerKeyHash.val[-3:] == "Yr;") +assert(singleResponse.certID.issuerNameHash.val[:3] == b"\xcf&\xf5" and singleResponse.certID.issuerNameHash.val[-3:] == b"\x8e_\n") +assert(singleResponse.certID.issuerKeyHash.val[:3] == b"Qh\xff" and singleResponse.certID.issuerKeyHash.val[-3:] == "Yr;") assert(singleResponse.certID.serialNumber.val == 0x77a5dc3362301f989fe54f7f86f3e64) assert(isinstance(singleResponse.certStatus.certStatus, OCSP_GoodInfo)) assert(singleResponse.thisUpdate == ASN1_GENERALIZED_TIME("20160914121000Z"))