retry: if positive, how many times to resend unanswered packets. if negative, how many consecutive unanswered probes before giving up. Only the negative value is really useful. timeout: how much time to wait after the last packet has been sent. By
default, sr will wait forever and the user will have to interrupt (Ctrl-C) it when he expects no more answers. inter: time in seconds to wait between each packet sent.
回顾Scapy's API documentation提出以下备选方案:
send
函数接受2个额外的参数,这些参数可能被证明是有用的:因此,执行以下语句将以无休止的循环发送数据包:
sr
函数接受3个可以证明有用的参数:由于对于发送的ARP包,预期不会接收到任何应答,因此使用所需值指定这些参数可以在有限循环中发送包,而上一个替代方案强制执行无休止的循环。在
不利的一面是,由于资源被分配给数据包接收和处理,所以这种效率可能有点低,但这可以忽略不计。在
因此,执行以下语句将在1000次迭代的有限循环中发送数据包:
相关问题 更多 >
编程相关推荐