scapy.route

Routing and handling of network interfaces.

class scapy.route.Route[source]

Bases: object

add(net='192.168.1.0/24', gw='1.2.3.4')[source]
delt(host|net, gw|dev)[source]
get_if_bcast(iff)[source]
ifadd(iff, addr)[source]
ifchange(iff, addr)[source]
ifdel(iff)[source]
invalidate_cache()[source]
make_route(host=None, net=None, gw=None, dev=None, metric=1)[source]
resync()[source]
route(dst=None, verbose=2)[source]

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