scapy.route

Routing and handling of network interfaces.

class scapy.route.Route[源代码]

基类:object

add(*args: Any, **kargs: Any) None[源代码]

Ex: add(net="192.168.1.0/24",gw="1.2.3.4")

delt(host|net, gw|dev)[源代码]
get_if_bcast(iff: str) List[str][源代码]
ifadd(iff: str, addr: str) None[源代码]
ifchange(iff: str, addr: str) None[源代码]
ifdel(iff: str) None[源代码]
invalidate_cache() None[源代码]
make_route(host: str | None = None, net: str | None = None, gw: str | None = None, dev: str | None = None, metric: int = 1) Tuple[int, int, str, str, str, int][源代码]
resync() None[源代码]
route(dst: str | None = None, verbose: int = 2) Tuple[str, str, str][源代码]

Returns the IPv4 routes to a host. :param - dst: the IPv4 of the destination host

returns: (iface, output_ip, gateway_ip)
  • iface: the interface used to connect to the host

  • output_ip: the outgoing IP that will be used

  • gateway_ip: the gateway IP that will be used