重新加载scapy conf
Reload scapy conf
我在整个应用程序的不同模块中使用了两次 scapy。然而,其中一个模块创建了一个新的 multiprocessing.Process 并在其中对网络命名空间进行系统调用 (308)。此时我需要重新加载 scapy,以便它重新定义其 conf 以与新的进程环境保持一致。
例如,差异低于正常导入($1)和网络命名空间导入($2)
0a1
> 0
2c3
< AS_resolver = <scapy.as_resolvers.AS_resolver_multi instance at 0x1af3c68>
---
> AS_resolver = <scapy.as_resolvers.AS_resolver_multi instance at 0x7f6cd218bc68>
22c23
< iface = 'TR_BR'
---
> iface = 'lo'
34c35
< neighbor = Ether -> ARP Ether -> IPv6 Dot3 -> IP Ether -> Dot1Q Ether -> L...
---
> neighbor = Ether -> LLC Ether -> ARP Ether -> IPv6 Ether -> Dot1Q Ether ->...
47c48
< route6 = Destination Next Hop iface src candidates fe80::/64 :: UNTR_BR ...
---
> route6 = Destination Next Hop iface src candidates ::1/128 :: lo ::1
通过更改解决:
conf.iface = 'lo'
conf.route.resync()
我在整个应用程序的不同模块中使用了两次 scapy。然而,其中一个模块创建了一个新的 multiprocessing.Process 并在其中对网络命名空间进行系统调用 (308)。此时我需要重新加载 scapy,以便它重新定义其 conf 以与新的进程环境保持一致。
例如,差异低于正常导入($1)和网络命名空间导入($2)
0a1
> 0
2c3
< AS_resolver = <scapy.as_resolvers.AS_resolver_multi instance at 0x1af3c68>
---
> AS_resolver = <scapy.as_resolvers.AS_resolver_multi instance at 0x7f6cd218bc68>
22c23
< iface = 'TR_BR'
---
> iface = 'lo'
34c35
< neighbor = Ether -> ARP Ether -> IPv6 Dot3 -> IP Ether -> Dot1Q Ether -> L...
---
> neighbor = Ether -> LLC Ether -> ARP Ether -> IPv6 Ether -> Dot1Q Ether ->...
47c48
< route6 = Destination Next Hop iface src candidates fe80::/64 :: UNTR_BR ...
---
> route6 = Destination Next Hop iface src candidates ::1/128 :: lo ::1
通过更改解决:
conf.iface = 'lo'
conf.route.resync()