From 2a7ad0d13aaaa2a5358f82c67877856863a30d61 Mon Sep 17 00:00:00 2001
From: gpotter2 <gabriel@potter.fr>
Date: Tue, 21 Mar 2017 19:38:17 +0100
Subject: [PATCH] Run auto parser

---
 scapy/arch/bpf/core.py                   |  6 +-
 scapy/arch/linux.py                      |  6 +-
 scapy/arch/pcapdnet.py                   | 12 ++--
 scapy/asn1/ber.py                        |  6 +-
 scapy/config.py                          |  2 +-
 scapy/contrib/HomePlugAV.py              | 72 +++++++++++-----------
 scapy/contrib/avs.py                     | 34 +++++------
 scapy/contrib/bgp.py                     |  6 +-
 scapy/contrib/carp.py                    |  4 +-
 scapy/contrib/cdp.py                     | 12 ++--
 scapy/contrib/coap.py                    |  6 +-
 scapy/contrib/dtp.py                     |  6 +-
 scapy/contrib/eigrp.py                   | 12 ++--
 scapy/contrib/isis.py                    | 10 +--
 scapy/contrib/ldp.py                     | 22 +++----
 scapy/contrib/openflow3.py               |  6 +-
 scapy/contrib/ospf.py                    |  6 +-
 scapy/contrib/pnio_rtc.py                | 12 ++--
 scapy/contrib/rsvp.py                    |  2 +-
 scapy/contrib/skinny.py                  | 10 +--
 scapy/contrib/vtp.py                     |  8 +--
 scapy/data.py                            |  4 +-
 scapy/fields.py                          | 24 ++++----
 scapy/layers/bluetooth.py                | 20 +++---
 scapy/layers/dhcp.py                     |  6 +-
 scapy/layers/dns.py                      | 16 ++---
 scapy/layers/dot11.py                    |  4 +-
 scapy/layers/gprs.py                     |  2 +-
 scapy/layers/hsrp.py                     |  4 +-
 scapy/layers/inet.py                     | 16 ++---
 scapy/layers/inet6.py                    | 56 ++++++++---------
 scapy/layers/ipsec.py                    |  2 +-
 scapy/layers/l2.py                       | 10 +--
 scapy/layers/lltd.py                     |  4 +-
 scapy/layers/mgcp.py                     |  4 +-
 scapy/layers/ntp.py                      | 78 ++++++++++++------------
 scapy/layers/pflog.py                    |  2 +-
 scapy/layers/ppp.py                      |  6 +-
 scapy/layers/rip.py                      |  4 +-
 scapy/layers/sctp.py                     | 20 +++---
 scapy/layers/smb.py                      | 14 ++---
 scapy/layers/tls/basefields.py           |  6 +-
 scapy/layers/tls/cert.py                 |  2 +-
 scapy/layers/tls/crypto/cipher_aead.py   |  4 +-
 scapy/layers/tls/crypto/cipher_block.py  |  4 +-
 scapy/layers/tls/crypto/cipher_stream.py |  2 +-
 scapy/layers/tls/crypto/curves.py        |  6 +-
 scapy/layers/tls/crypto/h_mac.py         |  8 +--
 scapy/layers/tls/crypto/pkcs1.py         | 38 ++++++------
 scapy/layers/tls/crypto/prf.py           |  8 +--
 scapy/layers/tls/handshake.py            | 10 +--
 scapy/layers/tls/keyexchange.py          | 18 +++---
 scapy/layers/x509.py                     |  2 +-
 scapy/pton_ntop.py                       |  6 +-
 scapy/themes.py                          | 28 ++++-----
 scapy/tools/UTscapy.py                   |  4 +-
 scapy/utils.py                           | 24 ++++----
 scapy/utils6.py                          | 40 ++++++------
 scapy/volatile.py                        | 10 +--
 59 files changed, 388 insertions(+), 388 deletions(-)

diff --git a/scapy/arch/bpf/core.py b/scapy/arch/bpf/core.py
index c02b744e..e862810c 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 9fe78381..614adbde 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 a5a1e273..0c3b8748 100644
--- a/scapy/arch/pcapdnet.py
+++ b/scapy/arch/pcapdnet.py
@@ -55,7 +55,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
@@ -78,7 +78,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
@@ -479,10 +479,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 []
@@ -494,7 +494,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:
@@ -524,7 +524,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 3a51187b..9c556569 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 b858065e..9bd8d54f 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 704720f3..76ebb95e 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/avs.py b/scapy/contrib/avs.py
index b31d58ec..8f40aff1 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 8ff0becc..d24dd58e 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/carp.py b/scapy/contrib/carp.py
index aba858fc..17fc37df 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 6730ea75..93d1ed86 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/coap.py b/scapy/contrib/coap.py
index fbd67d20..aa2a1f6f 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/dtp.py b/scapy/contrib/dtp.py
index d367d5a9..9996118a 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 a92782d5..55b48f8d 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/isis.py b/scapy/contrib/isis.py
index 814439a4..3b7122e3 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/ldp.py b/scapy/contrib/ldp.py
index 9614ad30..b27b3969 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/openflow3.py b/scapy/contrib/openflow3.py
index 9ef88587..48f83b4d 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/ospf.py b/scapy/contrib/ospf.py
index 83acc19d..15b2d5e9 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_rtc.py b/scapy/contrib/pnio_rtc.py
index 026b6e0f..6c9d7379 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/rsvp.py b/scapy/contrib/rsvp.py
index 208dcde9..e2b1247e 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 1ed02e42..215602db 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 0ebb17d8..8c6c8d01 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 b6d80536..65c829bb 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 25dbc2ec..0843adc4 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 ab48fbb3..5ee2fe76 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 139bb320..96094066 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 d29da49b..8e2f5cae 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 18a4bc4a..1bdbe33e 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 31a931fe..9b0ec4c6 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 9fa09c1d..f7a042f9 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 f20bf1d2..31fc420f 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 c6d8a537..c6058257 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 9153ac7c..fee198c3 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 ca87d469..584deda1 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 9a592edb..e70da86e 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 5d8a064e..2e4b5e07 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 15c69629..dd852012 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 a8fc9fe0..ead22510 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 e415eebf..191e8373 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 1507fe5c..643dde20 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 ff0b0946..886321f9 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 73ebe5b1..271e500c 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 cfa98d6e..c267d28a 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 8f816267..13f23675 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 3b9d84a0..dd759bb7 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 81dfb1da..d34695b0 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 6bfd1a37..aa8e2a7f 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 9a1d875e..bd6fe122 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 6be3803b..911bbb05 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 e4b49c41..eee8f52a 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 1f93f925..829ead27 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 5ee9aaea..2a90e423 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 cfff57b6..6df124c5 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 b5b03c9b..ba713dfb 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 8e6e8203..536ee308 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 a814159b..c7d2a1ff 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 28b12461..e038f6fc 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 58df161f..e597c172 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 3203e13c..cb78d2cf 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 152eb5bf..0fd379df 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",
-- 
GitLab