scapy.main

Main module for interactive startup.

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

Starts Scapy’s console.

scapy.main.list_contrib(name: Optional[str] = None, ret: bool = False, _debug: bool = False) Optional[List[Dict[str, str]]][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: Optional[Dict[str, Any]] = None, symb_list: Optional[List[str]] = 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: Optional[Dict[str, Any]] = None, symb_list: Optional[List[str]] = None) None[source]

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

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

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

scapy.main.load_session(fname: Optional[str] = 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: Optional[Dict[str, Any]] = 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: Optional[str] = None) None[source]

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

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