scapy.compat

Python 2 and 3 link classes.

scapy.compat.base64_bytes(x)

Turn base64 into bytes

scapy.compat.bytes_base64(x)

Turn bytes into base64

scapy.compat.bytes_encode(x)

Ensure that the given object is bytes. If the parameter is a packet, raw() should be preferred.

scapy.compat.bytes_hex(x)

Hexify a str or a bytes object

scapy.compat.chb(x)

Same than chr() but encode as bytes.

scapy.compat.hex_bytes(x)

De-hexify a str or a byte object

scapy.compat.lambda_tuple_converter(func)
Converts a Python 2 function as

lambda (x,y): x + y

In the Python 3 format:

lambda x,y : x + y

scapy.compat.orb(x)

Return ord(x) when not already an int.

scapy.compat.plain_str(x)

Convert basic byte objects to str

scapy.compat.raw(x)

Builds a packet and returns its bytes representation. This function is and always be cross-version compatible