scapy.main

Main module for interactive startup.

scapy.main.get_fancy_banner(mini: bool | None = None) str[source]

Generates the fancy Scapy banner

Parameters:

mini – if set, force a mini banner or not. Otherwise detect

scapy.main.init_session(session_name, mydict, ret)[source]
scapy.main.init_session(session_name, mydict=None, ret=False)
scapy.main.interact(mydict: Any | None = None, argv: Any | None = None, mybanner: Any | None = None, loglevel: int = 20) None[source]

Starts Scapy’s console.

scapy.main.list_contrib(name: str | None = None, ret: bool = False, _debug: bool = False) List[Dict[str, str]] | None[source]

Show the list of all existing contribs.

Parameters:
  • name – filter to search the contribs

  • ret – whether the function should return a dict instead of printing it

Returns:

None or a dictionary containing the results if ret=True

scapy.main.load_contrib(name: str, globals_dict: Dict[str, Any] | None = None, symb_list: List[str] | None = None) None[source]

Loads a Scapy contrib module to make variables, objects and functions available globally.

If no contrib module can be found with the given name, try to find a layer module, since a contrib module may become a layer module.

scapy.main.load_layer(name: str, globals_dict: Dict[str, Any] | None = None, symb_list: List[str] | None = None) None[source]

Loads a Scapy layer module to make variables, objects and functions available globally.

scapy.main.load_module(name: str, globals_dict: Dict[str, Any] | None = None, symb_list: List[str] | None = None) None[source]

Loads a Scapy module to make variables, objects and functions available globally.

scapy.main.load_session(fname: str | None = None) None[source]

Load current Scapy session from the file specified in the fname arg. This will erase any existing session.

params:
  • fname: file to load the scapy session from

scapy.main.save_session(fname: str = '', session: Dict[str, Any] | None = None, pickleProto: int = -1) None[source]

Save current Scapy session to the file specified in the fname arg.

params:
  • fname: file to save the scapy session in

  • session: scapy session to use. If None, the console one will be used

  • pickleProto: pickle proto version (default: -1 = latest)

scapy.main.update_ipython_session(session: Dict[str, Any]) None[source]

Updates IPython session with a custom one

scapy.main.update_session(fname: str | None = None) None[source]

Update current Scapy session from the file specified in the fname arg.

params:
  • fname: file to load the scapy session from