scapy.config
Implementation of the configuration object.
- class scapy.config.CacheInstance(name: str = 'noname', timeout: int | None = None)[source]
Bases:
Dict
[str
,Any
]- copy() CacheInstance [source]
- name
- timeout
- class scapy.config.Conf[source]
Bases:
ConfClass
This object contains the configuration of Scapy.
- ASN1_default_codec: scapy.asn1.asn1.ASN1Codec = None
Codec used by default for ASN1 objects
- AS_resolver: scapy.as_resolvers.AS_resolver = None
choose the AS resolver class to use
- BTsocket: Type[scapy.supersocket.SuperSocket] = None
- L2listen: Type[scapy.supersocket.SuperSocket] = None
- L2socket: Type[scapy.supersocket.SuperSocket] = None
- L3socket: Type[scapy.supersocket.SuperSocket] = None
- L3socket6: Type[scapy.supersocket.SuperSocket] = None
- auto_crop_tables = True
controls whether tables (conf.iface, conf.route…) should be cropped to fit the terminal
- auto_fragment = True
- bufsize = 65536
- cache_pcapiflist: Dict[str, Tuple[str, List[str], Any, str]] = {}
holds the cache of interfaces loaded from Libpcap
- checkIPID = False
if 0, doesn’t check that IPID matches between IP sent and ICMP IP citation received if 1, checks that they either are equal or byte swapped equals (bug in some IP stacks) if 2, strictly checks that they are equals
- checkIPaddr = True
- checkIPinIP = True
if True, checks that IP-in-IP layers match. If False, do not check IP layers that encapsulates another IP layer
- checkIPsrc = True
if 1, checks IP src in IP and ICMP IP citation match (bug in some NAT stacks)
- check_TCPerror_seqack = False
if 1, also check that TCP seq and ack match the ones in ICMP citation
- color_theme: ColorTheme
- commands: CommandsList = [<function restart>, <function hexdump>, <function linehexdump>, <function chexdump>, <function hexstr>, <function hexdiff>, <function fletcher16_checksum>, <function fletcher16_checkbytes>, <function corrupt_bytes>, <function corrupt_bits>, <function wrpcap>, <function wrpcapng>, <function rdpcap>, <function rderf>, <function wrerf>, <function import_hexcap>, <function wireshark>, <function tdecode>, <function tcpdump>, <function hexedit>, <function bind_layers>, <function split_layers>, <function explore>, <function ls>, <function rfc>, <function fuzz>, <function send>, <function sendp>, <function sendpfast>, <function sr>, <function sr1>, <function srp>, <function srp1>, <function srloop>, <function srploop>, <function srflood>, <function sr1flood>, <function srpflood>, <function srp1flood>, <function sniff>, <function bridge_and_sniff>, <function tshark>]
- contribs: Dict[str, Any] = {}
a dict which can be used by contrib layers to store local configuration
- crypto_valid = False
- crypto_valid_advanced = False
- debug_dissector = False
raise exception when a packet dissector raises an exception
- debug_match = False
when 1, store received packet that are not matched into debug.recv
- debug_tls = False
When 1, print some TLS session secrets when they are computed, and warn about the session recognition.
- dot15d4_protocol = None
- except_filter = ''
BPF filter for packets to ignore
- exts: ExtsManager = Name Version Modules
- fancy_banner = True
controls whether or not to display the fancy banner
- filter = ''
bpf filter added to every sniffing socket to exclude traffic from analysis
- geoip_city = None
- histfile: str = '/home/docs/.config/scapy/history'
history file
- iface: 'scapy.interfaces.NetworkInterface'
selects the default output interface for srp() and sendp().
- ifaces: scapy.interfaces.NetworkInterfaceDict = None
holds the Scapy interface list and manager
- interactive = False
- interactive_shell = 'auto'
can be “ipython”, “bpython”, “ptpython”, “ptipython”, “python” or “auto”. Default: Auto
- ipv6_enabled: bool = True
- ipython_use_jedi = False
Configuration for “ipython” to use jedi (disabled by default)
- layers: LayersList = [<class 'scapy.packet.Packet'>, <class 'scapy.packet.NoPayload'>, <class 'scapy.packet.Raw'>, <class 'scapy.packet.Padding'>, <class 'scapy.asn1packet.ASN1_Packet'>]
- load_layers: List[str] = ['bluetooth', 'bluetooth4LE', 'dcerpc', 'dhcp', 'dhcp6', 'dns', 'dot11', 'dot15d4', 'eap', 'gprs', 'hsrp', 'inet', 'inet6', 'ipsec', 'ir', 'isakmp', 'kerberos', 'l2', 'l2tp', 'ldap', 'llmnr', 'lltd', 'mgcp', 'mobileip', 'mspac', 'netbios', 'netflow', 'ntlm', 'ntp', 'ppi', 'ppp', 'pptp', 'radius', 'rip', 'rtp', 'sctp', 'sixlowpan', 'skinny', 'smb', 'smb2', 'smbclient', 'smbserver', 'snmp', 'tftp', 'vrrp', 'vxlan', 'x509', 'zigbee', 'tuntap']
- logLevel: int
- loopback_name: str = 'lo'
- manufdb: scapy.data.ManufDA = None
- max_list_count = 100
the maximum amount of items included in a PacketListField or a FieldListField
- Type:
a safety mechanism
- mib: scapy.asn1.mib.MIBDict = None
holds MIB direct access dictionary
- min_pkt_size = 60
- nameservers: str = None
holds the name servers IP/hosts used for custom DNS resolution
- neighbor: scapy.layers.l2.Neighbor = None
- nmap_base: str = ''
- nmap_kdb: NmapKnowledgeBase | None = None
- noenum: Resolve = <Resolve []>
holds list of enum fields for which conversion to string should NOT be done
- padding = 1
includes padding in disassembled packets
- prog: ProgPath = display = 'display' dot = 'dot' extcap_folders = ['/home/docs/.config/wireshark/extcap', '/usr/lib/x86_64-li... hexedit = 'hexer' ifconfig = 'ifconfig' pdfreader = 'xdg-open' psreader = 'xdg-open' svgreader = 'xdg-open' tcpdump = 'tcpdump' tcpreplay = 'tcpreplay' tshark = 'tshark' universal_open = 'xdg-open' wireshark = 'wireshark'
- prompt: str
- raise_no_dst_mac = False
When True, raise exception if no dst MAC found otherwise broadcast. Default is False.
- raw_summary: bool | Callable[[bytes], Any] = False
- recv_poll_rate = 0.05
how often to check for new packets. Defaults to 0.05s.
- route: scapy.route.Route = None
holds the Scapy IPv4 routing table and provides methods to manipulate it
- route6: scapy.route6.Route6 = None
holds the Scapy IPv6 routing table and provides methods to manipulate it
- session: str = ''
filename where the session will be saved
- sniff_promisc: bool = True
default mode for the promiscuous mode of a socket (to get answers if you spoof on a lan)
- stealth = 'not implemented'
if 1, prevents any unwanted packet to go out (ARP, DNS, …)
- temp_files: List[str] = []
- teredoPrefix: str = ''
- teredoServerPort: int = None
- tls_nss_filename
Filename containing NSS Keys Log
- tls_nss_keys: Dict[str, bytes] = None
Dictionary containing parsed NSS Keys
- tls_session_enable = False
When the TLS module is loaded (not by default), the following turns on sessions
- use_bpf: bool
- use_npcap = False
- use_pcap: bool
use libpcap integration or not. Changing this value will update the conf.L[2/3] sockets
- use_pypy: bool
read only attribute to show if PyPy is in use
- verb = 2
level of verbosity, from 0 (almost mute) to 3 (verbose)
- version: str
- warning_threshold = 5
how much time between warnings from the same place
- wepkey = ''
- class scapy.config.Emphasize[source]
Bases:
ConfigFieldList
- class scapy.config.ExtsManager[source]
Bases:
object
- GPLV2_CLASSIFIERS = ['License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)']
- SCAPY_PLUGIN_CLASSIFIER = 'Framework :: Scapy'
- class scapy.config.Interceptor(name: str, default: Any, hook: Callable[[...], Any], args: List[Any] | None = None, kargs: Dict[str, Any] | None = None)[source]
Bases:
object
- class scapy.config.LayersList[source]
Bases:
List
[Type
[scapy.packet.Packet
]]
- class scapy.config.NetCache[source]
Bases:
object
- add_cache(cache: CacheInstance) None [source]
- new_cache(name: str, timeout: int | None = None) CacheInstance [source]
- class scapy.config.Num2Layer[source]
Bases:
object
- class scapy.config.ProgPath[source]
Bases:
ConfClass
- display: str = 'display'
- dot: str = 'dot'
- extcap_folders: List[str] = ['/home/docs/.config/wireshark/extcap', '/usr/lib/x86_64-linux-gnu/wireshark/extcap']
- hexedit: str = 'hexer'
- ifconfig: str = 'ifconfig'
- pdfreader: str = 'xdg-open'
- psreader: str = 'xdg-open'
- svgreader: str = 'xdg-open'
- tcpdump: str = 'tcpdump'
- tcpreplay: str = 'tcpreplay'
- tshark: str = 'tshark'
- universal_open: str = 'xdg-open'
- wireshark: str = 'wireshark'
- class scapy.config.Resolve[source]
Bases:
ConfigFieldList
- class scapy.config.ScapyExt[source]
Bases:
object
- class MODE(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- CONTRIB = 'contrib'
- LAYERS = 'layers'
- MODULES = 'modules'
- class ScapyExtModule(name: str, mode: 'ScapyExt.MODE', module: module | None)[source]
Bases:
object
- module: module | None
- name: str
- modules: Dict[str, ScapyExtModule]
- name
- version
- scapy.config.crypto_validator(func: DecoratorCallable) DecoratorCallable [source]
This a decorator to be used for any method relying on the cryptography library. # noqa: E501 Its behaviour depends on the ‘crypto_valid’ attribute of the global ‘conf’.
- scapy.config.isCryptographyAdvanced() bool [source]
Check if the cryptography module is present, and if it supports X25519, ChaCha20Poly1305 and such.
Notes: - cryptography >= 2.0 is required - OpenSSL >= 1.1.0 is required