简体   繁体   English

进口scapy的最佳方法

[英]Best method of importing scapy

I've used: from scapy.all import * in the past however now I am getting conflicts (Queue) within the namespace. 我曾经使用过:来自scapy.all import *但是现在我在命名空间中遇到了冲突(队列)。

Whats the best method to import scapy? 什么是进口scapy的最佳方法? Methods I've looked into: 方法我研究过:

import scapy
import scapy.all
from scapy import all

I often use, when I do not want to overwrite my namespace: 我经常使用,当我不想覆盖我的命名空间时:

from scapy import all as scapy

After that everything is accessible under scapy. 之后,一切都可以在scapy.下访问scapy. :

scapy.send(scapy.IP()/scapy.ICMP())
from scapy.all import sr1,IP,ICMP

Is probably the best way of doing this. 这可能是最好的方法。

To import all the layers at once (to test packets against them) use: 要一次导入所有图层(针对它们测试数据包),请使用:

from scapy.layers import all
from scapy.all import srp,Ether,ARP,conf,send,arping

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM