MCPcopy Index your code
hub / github.com/secdev/scapy / add

Method add

scapy/route.py:91–114  ·  view source on GitHub ↗

Add a route to Scapy's IPv4 routing table. add(host|net, gw|dev) :param host: single IP to consider (/32) :param net: range to consider :param gw: gateway :param dev: force the interface to use :param metric: route metric Examples: -

(self, *args, **kargs)

Source from the content-addressed store, hash-verified

89 return (atol(thenet), itom(msk), gw, dev, ifaddr, metric)
90
91 def add(self, *args, **kargs):
92 # type: (*Any, **Any) -> None
93 """Add a route to Scapy's IPv4 routing table.
94 add(host|net, gw|dev)
95
96 :param host: single IP to consider (/32)
97 :param net: range to consider
98 :param gw: gateway
99 :param dev: force the interface to use
100 :param metric: route metric
101
102 Examples:
103
104 - `ip route add 192.168.1.0/24 via 192.168.0.254`::
105 >>> conf.route.add(net="192.168.1.0/24", gw="192.168.0.254")
106
107 - `ip route add 192.168.1.0/24 dev eth0`::
108 >>> conf.route.add(net="192.168.1.0/24", dev="eth0")
109
110 - `ip route add 192.168.1.0/24 via 192.168.0.254 metric 1`::
111 >>> conf.route.add(net="192.168.1.0/24", gw="192.168.0.254", metric=1)
112 """
113 self.invalidate_cache()
114 self.routes.append(self.make_route(*args, **kargs))
115
116 def delt(self, *args, **kargs):
117 # type: (*Any, **Any) -> None

Callers 8

conversationsMethod · 0.45
__init__Method · 0.45
select_objectsFunction · 0.45
add_breakpointsMethod · 0.45
any2iMethod · 0.45
m2iMethod · 0.45
i2reprMethod · 0.45

Calls 3

invalidate_cacheMethod · 0.95
make_routeMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected