scapy.route

Routing and handling of network interfaces.

class scapy.route.Route

Bases: object

add(*args, **kargs)

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

delt(host|net, gw|dev)
get_if_bcast(iff)
ifadd(iff, addr)
ifchange(iff, addr)
ifdel(iff)
invalidate_cache()
make_route(host=None, net=None, gw=None, dev=None, metric=1)
resync()
route(dst=None, verbose=2)

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